/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ventas_sie_impresionfacturas.java
 *
 * Created on 16/06/2012, 11:33:47 AM
 */

package sie_invdis;

import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
import java.text.*;
import java.text.ParseException;
import javax.swing.table.DefaultTableCellRenderer;
/**
 *
 * @author Administrador
 */
public class ventas_sie_impresionfacturas extends javax.swing.JFrame {
  private bd_conexion x = new bd_conexion() ;
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
       //se creaa la variable resultset
    private ResultSet rs = null;
    private javax.swing.table.DefaultTableModel jtable_modelo_facturacompleta;
    private javax.swing.table.DefaultTableModel jtable_modelo_facturabloque;
    private javax.swing.table.DefaultTableModel jtable_modelo;
    private javax.swing.table.DefaultTableModel jtable_modelo_facturas;
    DefaultTableCellRenderer alinearCentro, alinearderecha, alinearIzquierda;
    private JTable jtable_tiendas;
    int buscamp=1,opcionimporte=1,opcionacumular=2;
    private DefaultListModel modelo ;
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
    private java.util.Date fechahoy=new Date();
    /** Creates new form ventas_sie_impresionfacturas */
    public ventas_sie_impresionfacturas() {
        iniciar_modelo_de_tablafacturabloque();
        iniciar_modelo_de_tablafacturacompleto();
        iniciar_modelo_tiendasfacturas();
        this.iniciar_modelo_facturas();

        initComponents();
        this.loadcombo();
        this.loadcombo_quienfactura();
        this.buttonGroup1.setSelected(jrbtn_recepcion.getModel(), true);
        this.buttonGroup2.setSelected(jrbtn_importecosto.getModel(), true);
        this.buttonGroup3.setSelected(jrbtn_acuitempr.getModel(), true);

        jt_formatofactura2.getColumnModel().getColumn(0).setPreferredWidth(10);//cantidad
        jt_formatofactura2.getColumnModel().getColumn(1).setPreferredWidth(30);//codigo
        jt_formatofactura2.getColumnModel().getColumn(2).setPreferredWidth(90);//descripcion.
        jt_formatofactura2.getColumnModel().getColumn(3).setPreferredWidth(70);//item
        jt_formatofactura2.getColumnModel().getColumn(4).setPreferredWidth(60);//Precio
        jt_formatofactura2.getColumnModel().getColumn(5).setPreferredWidth(40);//id
        jt_formatofactura2.getColumnModel().getColumn(6).setPreferredWidth(40);//id

        jt_formatofactura1.getColumnModel().getColumn(0).setPreferredWidth(30);//cantidad
        jt_formatofactura1.getColumnModel().getColumn(1).setPreferredWidth(90);//codigo
        jt_formatofactura1.getColumnModel().getColumn(2).setPreferredWidth(70);//descripcion.
        jt_formatofactura1.getColumnModel().getColumn(3).setPreferredWidth(60);//item
        jt_formatofactura1.getColumnModel().getColumn(4).setPreferredWidth(40);//Precio
        jt_formatofactura1.getColumnModel().getColumn(5).setPreferredWidth(15);//id
        jt_formatofactura1.getColumnModel().getColumn(6).setPreferredWidth(15);//id
        jt_formatofactura1.getColumnModel().getColumn(7).setPreferredWidth(40);//id

        jtbl_facturasg.getColumnModel().getColumn(0).setPreferredWidth(15);//cantidad
        jtbl_facturasg.getColumnModel().getColumn(1).setPreferredWidth(5);//codigo
        jtbl_facturasg.getColumnModel().getColumn(2).setPreferredWidth(40);//descripcion.
        jtbl_facturasg.getColumnModel().getColumn(3).setPreferredWidth(60);//item
        jtbl_facturasg.getColumnModel().getColumn(4).setPreferredWidth(60);//Precio
        jtbl_facturasg.getColumnModel().getColumn(5).setPreferredWidth(5);//id
        jtbl_facturasg.getColumnModel().getColumn(6).setPreferredWidth(60);//id
        jtbl_facturasg.getColumnModel().getColumn(7).setPreferredWidth(60);//id
        jtbl_facturasg.getColumnModel().getColumn(8).setPreferredWidth(15);//id
        jtbl_facturasg.getColumnModel().getColumn(9).setPreferredWidth(40);//id
        jtbl_facturasg.getColumnModel().getColumn(10).setPreferredWidth(40);//id
        jtbl_facturasg.getColumnModel().getColumn(11).setPreferredWidth(40);//id
        jtbl_facturasg.getColumnModel().getColumn(12).setPreferredWidth(50);//id
        jtbl_facturasg.getColumnModel().getColumn(13).setPreferredWidth(50);//id

        this.jtf_ffecha.setText(this.fechaeuropea(fechahoy).replace("-", "/"));
    }
 private void iniciar_modelo_de_tablafacturacompleto()
    {
        jtable_modelo_facturacompleta=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_facturacompleta.addColumn("<html><b>Id</b></html>");
        jtable_modelo_facturacompleta.addColumn("<html><b>Cant.</b></html>");
        jtable_modelo_facturacompleta.addColumn("<html><b>Descripcion</b></html>");
        jtable_modelo_facturacompleta.addColumn("<html><b>Codigo</b></html>");
        jtable_modelo_facturacompleta.addColumn("<html><b>Item</b></html>");
        jtable_modelo_facturacompleta.addColumn("<html><b>Costo</b></html>");
        jtable_modelo_facturacompleta.addColumn("<html><b>Importe</b></html>");
    }
  private void iniciar_modelo_de_tablafacturabloque()
    {
        jtable_modelo_facturabloque=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_facturabloque.addColumn("<html><b>Cant.</b></html>");
        jtable_modelo_facturabloque.addColumn("<html><b>Descripcion</b></html>");
        jtable_modelo_facturabloque.addColumn("<html><b>Codigo</b></html>");
        jtable_modelo_facturabloque.addColumn("<html><b>Item</b></html>");
        jtable_modelo_facturabloque.addColumn("<html><b>Costo</b></html>");
        jtable_modelo_facturabloque.addColumn("<html><b>%desc</b></html>");
        jtable_modelo_facturabloque.addColumn("<html><b>%I.V.A.</b></html>");
        jtable_modelo_facturabloque.addColumn("<html><b>Importe</b></html>");
    }
  public void centrar_datos()
    {
        alinearderecha = new DefaultTableCellRenderer();
        alinearderecha.setHorizontalAlignment(SwingConstants.RIGHT);

        jt_formatofactura2.getColumnModel().getColumn(5).setCellRenderer(alinearderecha);
        jt_formatofactura2.getColumnModel().getColumn(6).setCellRenderer(alinearderecha);

        jt_formatofactura1.getColumnModel().getColumn(4).setCellRenderer(alinearderecha);
        jt_formatofactura1.getColumnModel().getColumn(7).setCellRenderer(alinearderecha);

    }
private void iniciar_modelo_facturas()
    {
        jtable_modelo_facturas=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_facturas.addColumn("<html><b>Tipo</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Status</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Documento</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Cliente</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>R.f.c.</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Pag.</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Factura</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Fecha</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Hora</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Subtotal</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Impuesto</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Total</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Observaciones</b></html>");
        jtable_modelo_facturas.addColumn("<html><b>Usuario</b></html>");
   }

  private void iniciar_modelo_tiendasfacturas()
    {
        modelo = new javax.swing.DefaultListModel();
        try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_distribucion_clientes_activos() as (id smallint,idcleinte character varying(12),ordenvisua smallint,clientenombre character varying(60),orden smallint);",variables_global.getconexiongral());
               while (rs.next())
                    {
                          modelo.addElement(rs.getString("idcleinte")+":"+rs.getString("clientenombre"));
                    }
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }
 private void loadcombo(){
        jtable_tiendas=variables_global.gettabla_tiendas();
         int numerotiendas=this.jtable_tiendas.getRowCount();
         this.jcbx_tiendas.addItem("0:Selecciones Una Tienda");
          for(int ii=0;ii<numerotiendas;ii++)
                        {
                            this.jcbx_tiendas.addItem(jtable_tiendas.getValueAt(ii, 1)+":"+jtable_tiendas.getValueAt(ii, 0));
                        }
    }
  private void loadcombo_quienfactura(){
          this.jcbx_facturara.addItem("0:Elige quien Factura?");
          this.jcbx_facturara.addItem("MARIA DE J:PERSONA FISICA CON ACTIVIDAD EMPRESARIAL");
          this.jcbx_facturara.addItem("ESTEFANIA:PERSONA FISICA CON ACTIVIDAD EMPRESARIAL");
          this.jcbx_facturara.addItem("GRUPO ESL.:REGIMEN GENERAL DE LEY, PERSONA MORAL");
          this.jcbx_facturara.addItem("GRUPO ESL.:  .");

    }
private String  fechaeuropea(Date fecha) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";

       cadenafecha= formateadorestaeuropa.format(fecha);
       return cadenafecha;
    }

 private void calcularimportesfactura()
    {
     DecimalFormat miformat = new DecimalFormat("###,###,###,###.##");
     DecimalFormat miformatim = new DecimalFormat("############.##");
     int numerofilas=this.jtable_modelo_facturabloque.getRowCount(),error=0;
    String punto="",comas="",imagen="";
    float cantidad=0,costo=0,importefila=0,descuento=0,impuesto=0,doctosubtotal=0,doctoimpuesto=0,doctodescuento=0,doctototal=0,piezasindi=0,doctoimpuestop=0;
    System.out.println("calculandoimporte"+numerofilas);
     for(int i = 0 ;i < numerofilas; i++)
                {
                 try
                       {
                            cantidad = Float.valueOf(this.jtable_modelo_facturabloque.getValueAt(i, 0).toString()).floatValue();
                            costo = Float.valueOf(this.jtable_modelo_facturabloque.getValueAt(i, 4).toString()).floatValue();
                            piezasindi+=cantidad;
                            descuento=(costo*cantidad)*(Float.valueOf(this.jtable_modelo_facturabloque.getValueAt(i, 5).toString())/100);
                            importefila=(cantidad*costo);

                            impuesto=(importefila-descuento)*Float.valueOf(this.jtable_modelo_facturabloque.getValueAt(i, 6).toString())/100;
                            //System.out.println(descuento+":"+impuesto);
                            doctodescuento+=descuento;
                            doctosubtotal+=importefila;
                            doctoimpuestop+=impuesto;

                        }
                            catch (NumberFormatException nfe) {
                            cantidad=0;
                            costo=0;
                            error=1;
                        }
                      jtable_modelo_facturabloque.setValueAt(miformatim.format(importefila),i,7);
                }
    //doctoimpuesto=(doctosubtotal-doctodescuento)*impuesto;
    doctototal=(doctosubtotal-doctodescuento)+doctoimpuestop;
    this.jtf_fsubtotal.setText(miformat.format(doctosubtotal));
    this.jtf_fdescuento.setText(miformat.format(doctodescuento));
    this.jtf_fImpuesto.setText(miformat.format(doctoimpuestop));
    this.jtf_ftotal.setText(miformat.format(doctototal));
    this.jtf_importepesos.setText(this.PesosMN(doctototal));
    }

  private void calcularimportesfactura_gral()
    {
     DecimalFormat miformat = new DecimalFormat("###,###,###,###.##");
     DecimalFormat miformatim = new DecimalFormat("############.##");
     int numerofilas=this.jtable_modelo_facturacompleta.getRowCount(),error=0;
    String punto="",comas="",imagen="";
    float cantidad=0,costo=0,importefila=0,descuento=0,impuesto=0,doctosubtotal=0,doctoimpuesto=0,doctodescuento=0,doctototal=0,piezasindi=0,doctoimpuestop=0;
    System.out.println("calculandoimporte"+numerofilas);
     for(int i = 0 ;i < numerofilas; i++)
                {
                 try
                       {
                            cantidad = Float.valueOf(this.jtable_modelo_facturacompleta.getValueAt(i, 1).toString()).floatValue();
                            costo = Float.valueOf(this.jtable_modelo_facturacompleta.getValueAt(i, 5).toString()).floatValue();
                            piezasindi+=cantidad;
                            descuento=(costo*cantidad)*(Float.valueOf(this.jtf_fdesc.getText().toString())/100);
                            importefila=(cantidad*costo);

                            impuesto=(importefila-descuento)*Float.valueOf(this.jtf_fpimpu.getText().toString())/100;
                            //System.out.println(descuento+":"+impuesto);
                            doctodescuento+=descuento;
                            doctosubtotal+=importefila;
                            doctoimpuestop+=impuesto;

                        }
                            catch (NumberFormatException nfe) {
                            cantidad=0;
                            costo=0;
                            error=1;
                        }
                      //jtable_modelo_facturabloque.setValueAt(miformatim.format(importefila),i,7);
                }
    //doctoimpuesto=(doctosubtotal-doctodescuento)*impuesto;
    doctototal=(doctosubtotal-doctodescuento)+doctoimpuestop;
    this.jtf_fsubtotalgral.setText(miformat.format(doctosubtotal));
    this.jtf_fdescuentogral.setText(miformat.format(doctodescuento));
    this.jtf_fImpuestogral.setText(miformat.format(doctoimpuestop));
    this.jtf_ftotalgral.setText(miformat.format(doctototal));

    }
  private void calcularimportesquitarpor()
    {
     DecimalFormat miformat = new DecimalFormat("###,###,###,###.##");
     DecimalFormat miformatim = new DecimalFormat("############.##");
     int numerofilas=this.jtable_modelo_facturacompleta.getRowCount(),error=0;
    String punto="",comas="",imagen="";
    float cantidad=0,costo=0,importefila=0,descuento=0,impuesto=0,doctosubtotal=0,doctoimpuesto=0,doctodescuento=0,doctototal=0,piezasindi=0,doctoimpuestop=0;
    System.out.println("calculandoimporte"+numerofilas);
     for(int i = 0 ;i < numerofilas; i++)
                {
                 try
                       {

                            costo = Float.valueOf(this.jtable_modelo_facturacompleta.getValueAt(i, 5).toString()).floatValue();
                            descuento=costo/((Float.valueOf(this.jtf_fotosartxpag1.getText().toString())/100)+1);
                            jtable_modelo_facturacompleta.setValueAt(miformatim.format(descuento),i,5);

                        }
                            catch (NumberFormatException nfe) {
                            cantidad=0;
                            costo=0;
                            error=1;
                        }
                      //jtable_modelo_facturabloque.setValueAt(miformatim.format(importefila),i,7);
                }
  }

    private void carga_datos_detalle(String folio)
            {
      int id_incrementable=0;
        if (this.jcbx_acumfolios.isSelected()==false)
                {
                    while(jtable_modelo_facturacompleta.getRowCount()>0)jtable_modelo_facturacompleta.removeRow(0);
                }


      int fila=0;
      DecimalFormat miformat = new DecimalFormat("############.##");
        try
            {
            rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_ventas_detalle(3,'"+folio+"') as (idreg integer,iddocto character varying(12), ida character varying(16),cant_ar numeric, costoarticulo numeric,precioarti numeric,importe numeric,observ_p character varying(60),descr character varying(80),unidadsal character varying(3),descorta character varying(20),controlalma character varying(20),precio1 numeric,ite character varying(20),precio_v numeric,ultcosto numeric,desc1 numeric,desc2 numeric,impuesto1 numeric,dif_rep numeric,politicades smallint,tipocam numeric,idarticulosubmod character varying(4));",variables_global.getconexiongral());
            while (rs.next())
                {
                        if  (rs.getFloat("cant_ar")>0)
                            {
                           switch (opcionimporte) {
                                    case 1:
                                            this.crea_hoja_factura(folio,rs.getString ("cant_ar"),rs.getString ("descorta"),rs.getString ("ida"),miformat.format(rs.getFloat("costoarticulo")),miformat.format(rs.getFloat("costoarticulo")*rs.getFloat("cant_ar")),rs.getString ("descorta").replace(".", "")+".",rs.getString ("ite").replace(".", "")+".",rs.getString ("controlalma").replace(".", "")+".");
                                    break;
                                    case 2:
                                            this.crea_hoja_factura(folio,rs.getString ("cant_ar"),rs.getString ("descorta"),rs.getString ("ida"),miformat.format(rs.getFloat("precio_v")),miformat.format(rs.getFloat("precio_v")*rs.getFloat("cant_ar")),rs.getString ("descorta").replace(".", "")+".",rs.getString ("ite").replace(".", "")+".",rs.getString ("controlalma").replace(".", "")+".");
                                    break;
                                    }

                            }
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
      }

private void carga_datos_detalle_tras(int opbus,String folio)
{
     if (this.jcbx_acumfolios.isSelected()==false)
                {
                    while(jtable_modelo_facturacompleta.getRowCount()>0)jtable_modelo_facturacompleta.removeRow(0);
                }
       DecimalFormat miformat = new DecimalFormat("###,###,###,###.##");
       String texto="select * from x1sieuno_articulo_traspasos_detalle("+opbus+","+folio+") as (id integer,Cns_det_tra integer,idproducto integer,Cns_det_pro integer,clave_producto text,descuento real,precio real,cantidad_enviado real,cantidad_recibido real,Id_cat_des integer,Id_det_des integer,descripcion character varying(80),item character varying(80),control character varying(20),tement character varying(25),costo real,descor character varying(20));",co="";
       System.out.println(texto);

       try
         {
             rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                    if(rs.getString ("control")!=null)
                        co=rs.getString ("control").replace(".", "");
                    else
                        co=".";
                    if  (rs.getFloat("cantidad_enviado")>0)
                            {
                              switch (opcionimporte) {
                                    /*case 1:
                                            jtable_modelo_facturacompleta.addRow(new Object[]{folio,rs.getString ("cantidad_enviado"),rs.getString ("descripcion"),rs.getString ("clave_producto"),rs.getString ("item"),miformat.format(rs.getFloat("costo")),miformat.format(rs.getFloat("costo")*rs.getFloat("cantidad_enviado"))});
                                    break;
                                    case 2:
                                            jtable_modelo_facturacompleta.addRow(new Object[]{folio,rs.getString ("cantidad_enviado"),rs.getString ("descripcion"),rs.getString ("clave_producto"),rs.getString ("item"),miformat.format(rs.getFloat("precio")),miformat.format(rs.getFloat("precio")*rs.getFloat("cantidad_enviado"))});
                                    break;*/
                                    case 1:
                                            this.crea_hoja_factura(folio,rs.getString ("cantidad_enviado"),rs.getString ("descor"),rs.getString ("clave_producto"),miformat.format(rs.getFloat("costo")),miformat.format(rs.getFloat("costo")*rs.getFloat("cantidad_enviado")),rs.getString ("descor").replace(".", "")+".",rs.getString ("item").replace(".", "")+".",co);
                                    break;
                                    case 2:
                                            this.crea_hoja_factura(folio,rs.getString ("cantidad_enviado"),rs.getString ("descor"),rs.getString ("clave_producto"),miformat.format(rs.getFloat("precio")),miformat.format(rs.getFloat("precio")*rs.getFloat("cantidad_enviado")),rs.getString ("descor").replace(".", "")+".",rs.getString ("item").replace(".", "")+".",co);
                                    break;
                                    }

                            }
                }
        }
        catch(Exception e)
            {
                System.out.println(e.getMessage());
            }

}
private void carga_datos_detalle_movextra(int opcion,String idtienda,String busca)
 {
   if (this.jcbx_acumfolios.isSelected()==false)
                {
                    while(jtable_modelo_facturacompleta.getRowCount()>0)jtable_modelo_facturacompleta.removeRow(0);
                }
        DecimalFormat miformat = new DecimalFormat("###,###,###,###.##");
       //invoco al metodo que trae el recordset de datos
       String co="";
        try
         {
            rs = x.sieuno_executediversosv2("select * from x1sieuno_articulo_almacen_movextras_detalle("+opcion+",'"+busca+"',"+idtienda+") as (idmov integer,cns_det_movext integer,cantidadpro real,idalmacenproducto integer,precio real,idtipven integer,preciocosto real,existencia double precision,idproducto integer,cns_det_pro integer,descripcioncorta text,precioactual double precision,prerebajaactual real,clave_producto text,item character varying(80),control character varying(20),descor character varying(20));",variables_global.getconexiongral());
            while (rs.next())
                {
                if(rs.getString ("control")!=null)
                        co=rs.getString ("control").replace(".", "");
                    else
                        co=".";
                    if  (rs.getFloat("cantidadpro")>0)
                            {
                                   switch (opcionimporte) {
                                    /*case 1:
                                            jtable_modelo_facturacompleta.addRow(new Object[]{busca,rs.getString ("cantidadpro"),rs.getString ("descripcioncorta"),rs.getString ("clave_producto"),".",miformat.format(rs.getFloat("preciocosto")),miformat.format(rs.getFloat("preciocosto")*rs.getFloat("cantidadpro"))});
                                    break;
                                    case 2:
                                            jtable_modelo_facturacompleta.addRow(new Object[]{busca,rs.getString ("cantidadpro"),rs.getString ("descripcioncorta"),rs.getString ("clave_producto"),".",miformat.format(rs.getFloat("precio")),miformat.format(rs.getFloat("precio")*rs.getFloat("cantidadpro"))});
                                    break;*/
                                    case 1:
                                            this.crea_hoja_factura(busca,rs.getString ("cantidadpro"),rs.getString ("descor"),rs.getString ("clave_producto"),miformat.format(rs.getFloat("preciocosto")),miformat.format(rs.getFloat("preciocosto")*rs.getFloat("cantidadpro")),rs.getString ("descor").replace(".", "")+".",rs.getString ("item").replace(".", "")+".",rs.getString ("control").replace(".", "")+".");
                                    break;
                                    case 2:
                                            this.crea_hoja_factura(busca,rs.getString ("cantidadpro"),rs.getString ("descor"),rs.getString ("clave_producto"),miformat.format(rs.getFloat("precio")),miformat.format(rs.getFloat("precio")*rs.getFloat("cantidadpro")),rs.getString ("descor").replace(".", "")+".",rs.getString ("item").replace(".", "")+".",rs.getString ("control").replace(".", "")+".");
                                    break;
                                    }


                            }
                }

        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
}

private void carga_datos_detallepedido(int opcion,String idtienda,String busca)
 {
 if (this.jcbx_acumfolios.isSelected()==false)
                {
                    while(jtable_modelo_facturacompleta.getRowCount()>0)jtable_modelo_facturacompleta.removeRow(0);
                }
        DecimalFormat miformat = new DecimalFormat("###,###,###,###.##");
        String texto="select * from x1venta_pedidos_completo_detalle("+opcion+",'"+idtienda+"','"+busca+"','') as (idpedido integer,cns_detpet integer,piezas real,idalmpro integer,descuento real,precio real,idcatdes integer,iddetdes integer,idtipvent integer,importeprecioneto double precision,importepreciosindesc real,idproducto integer,claveproducto character varying(16),productodescribe character varying(80),ultimocosto numeric,familia integer,subfamilia integer,item character varying(80),temporadaingreso smallint,importecosto double precision,control character varying(20),descor character varying(20));",co="";
        System.out.println("en pedido"+texto);
        try
        {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                 if(rs.getString ("control")!=null)
                        co=rs.getString ("control").replace(".", "");
                    else
                        co=".";
                    if  (rs.getFloat("piezas")>0)
                            {
                                    switch (opcionimporte) {
                                    /*case 1:
                                            jtable_modelo_facturacompleta.addRow(new Object[]{busca,rs.getString ("piezas"),rs.getString ("productodescribe"),rs.getString ("claveproducto"),".",miformat.format(rs.getFloat("ultimocosto")),miformat.format(rs.getFloat("ultimocosto")*rs.getFloat("piezas"))});
                                    break;
                                    case 2:
                                            jtable_modelo_facturacompleta.addRow(new Object[]{busca,rs.getString ("piezas"),rs.getString ("productodescribe"),rs.getString ("claveproducto"),".",miformat.format(rs.getFloat("precio")),miformat.format(rs.getFloat("precio")*rs.getFloat("piezas"))});
                                    break;*/
                                    case 1:
                                            this.crea_hoja_factura(busca,rs.getString ("piezas"),rs.getString ("descor"),rs.getString ("claveproducto"),miformat.format(rs.getFloat("ultimocosto")),miformat.format(rs.getFloat("ultimocosto")*rs.getFloat("piezas")),rs.getString ("descor").replace(".", "")+".",rs.getString ("item").replace(".", "")+".",co);
                                    break;
                                    case 2:
                                            this.crea_hoja_factura(busca,rs.getString ("piezas"),rs.getString ("descor"),rs.getString ("claveproducto"),miformat.format(rs.getFloat("precio")),miformat.format(rs.getFloat("precio")*rs.getFloat("piezas")),rs.getString ("descor").replace(".", "")+".",rs.getString ("item").replace(".", "")+".",co);
                                    break;

                                    }

                            }
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
}


private void carga_datos_detallecredito(int opcion,String idtienda,String busca)
 {
 if (this.jcbx_acumfolios.isSelected()==false)
                {
                    while(jtable_modelo_facturacompleta.getRowCount()>0)jtable_modelo_facturacompleta.removeRow(0);
                }
        DecimalFormat miformat = new DecimalFormat("###,###,###,###.##");
        String texto="select * from x1venta_credito_catalogo_detalle("+opcion+","+idtienda+",'"+busca+"','','') as (idcredito integer,cntdet integer,cantidad real,idalmpro integer,descuento real,precio real,idproducto integer,desccorta text,claveproducto text,importesindesc double precision,ultimocosto numeric,famarti integer,idsubfam integer,item character varying(80),control character varying(20),idtemingre smallint,nombrefamilia character varying(30),nombresubfamilia character varying(50),temporadaentrada character varying(25),descor character varying(20));";
        System.out.println(texto);
        try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                    if  (rs.getFloat("cantidad")>0)
                            {
                                   switch (opcionimporte) {
                                    /*case 1:
                                            jtable_modelo_facturacompleta.addRow(new Object[]{busca,rs.getString ("cantidad"),rs.getString ("desccorta"),rs.getString ("claveproducto"),".",miformat.format(rs.getFloat("ultimocosto")),miformat.format(rs.getFloat("ultimocosto")*rs.getFloat("cantidad"))});
                                    break;
                                    case 2:
                                            jtable_modelo_facturacompleta.addRow(new Object[]{busca,rs.getString ("cantidad"),rs.getString ("desccorta"),rs.getString ("claveproducto"),".",miformat.format(rs.getFloat("precio")),miformat.format(rs.getFloat("precio")*rs.getFloat("cantidad"))});
                                    break;*/
                                    case 1:
                                            this.crea_hoja_factura(busca,rs.getString ("cantidad"),rs.getString ("descor"),rs.getString ("claveproducto"),miformat.format(rs.getFloat("ultimocosto")),miformat.format(rs.getFloat("ultimocosto")*rs.getFloat("cantidad")),rs.getString ("descor").replace(".", "")+".",rs.getString ("item").replace(".", "")+".",rs.getString ("control").replace(".", "")+".");
                                    break;
                                    case 2:
                                            this.crea_hoja_factura(busca,rs.getString ("cantidad"),rs.getString ("descor"),rs.getString ("claveproducto"),miformat.format(rs.getFloat("precio")),miformat.format(rs.getFloat("precio")*rs.getFloat("cantidad")),rs.getString ("descor").replace(".", "")+".",rs.getString ("item").replace(".", "")+".",rs.getString ("control").replace(".", "")+".");
                                    break;
                                    }
                            }
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
}

    private void carga_datos_clientesactualiza(int opcion,String textobusca)
    {
       String texto="select * from x1distribucion_terminados_ventas_clientes_catalogo("+opcion+",'"+textobusca+"','') as (id character varying(12),nombre character varying(60),direccion character varying(50),colonia character varying(50),poblacion character varying(40),cpcliente character varying(6),rfc character varying(15),curp character varying(20),telefono character varying(80),fax character varying(15),email character varying(80),clasif smallint,diascre smallint,limite numeric,descliente numeric,fechaultv date,fechaultp date,obser character varying(80),idstatus smallint,direccion2 character varying(80),statusdes character varying(40),descripcla character varying(40),atnven character varying(60),atncob character varying(60),acumcli numeric,idreg integer);";
       System.out.println(texto);
       try
       {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                       this.jtf_idcliente1.setText(rs.getString("id"));
                       this.jtf_cliente.setText(rs.getString("nombre"));
                       this.jtf_domcalle1.setText(rs.getString("direccion"));
                       this.jtf_domcolonia1.setText(rs.getString("colonia"));
                       this.jtf_dompobla1.setText(rs.getString("poblacion"));
                       this.jtf_email2.setText(rs.getString("email"));
                       this.jtf_cp.setText(rs.getString("cpcliente"));
                       this.jtf_rfc1.setText(rs.getString("rfc"));
                       this.jtf_tel.setText(rs.getString("telefono"));
                       this.jtf_direccion3.setText(rs.getString("direccion2"));
                       this.jtf_atnventas.setText(rs.getString("atnven"));
                       this.jtf_atncobra.setText(rs.getString("atncob"));
                       this.jtf_observaciones1.setText(rs.getString("obser"));
                }
        }
        catch(Exception e)
            {
            System.out.println(e.getMessage());
            }
   }

private void carga_datos_facturas(int opcion,String busca,String busca1)
 {
        while(jtable_modelo_facturas.getRowCount()>0)jtable_modelo_facturas.removeRow(0);
        DecimalFormat miformat = new DecimalFormat("###,###,###,###.##");
       //invoco al metodo que trae el recordset de datos
        String texto="select * from x1distribucion_terminados_ventas_facturas("+opcion+",'"+busca+"','"+busca1+"') as (id integer,idtipodoc smallint,iddoc text,idcliente character varying(12),fecha date,hora time,idempleado integer,idfolfac character varying(12),subtotal numeric,impuesto numeric, total numeric,pagina smallint,codigoiniyfin character varying(35),idstatus smallint,observa text, nombreem character varying(50),nombreapat character varying(50),nombreclie character varying(60),rfcclie character varying(15));";
        System.out.println(texto);
        try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                       jtable_modelo_facturas.addRow(new Object[]{rs.getString ("id"),rs.getString ("idstatus"),rs.getString ("iddoc"),rs.getString ("idcliente")+":"+rs.getString ("nombreclie"),rs.getString ("rfcclie"),rs.getString ("pagina"),rs.getString ("idfolfac"),this.fechaeuropea(rs.getString ("fecha")),rs.getString ("hora").substring(0, 5),miformat.format(rs.getFloat("subtotal")),miformat.format(rs.getFloat("impuesto")),miformat.format(rs.getFloat("total")),rs.getString ("observa"),rs.getString ("nombreem")+" "+rs.getString ("nombreapat")});
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
}
  private void crea_hoja_factura(String folio,String cantidad,String descripcion,String codigo,String costo,String importe,String descor,String item,String controlalma)
    {
        DecimalFormat miformat = new DecimalFormat("###,###,###");
        int numerofilas=this.jtable_modelo_facturacompleta.getRowCount(),ii=00,encontrado=0;
        String idstat="",clavecompara="";
        float cantiant=0;
        Object[] fnewRow = new Object[12];
        for( ii=0;ii<numerofilas;ii++)
                {
                   if (opcionacumular==1)
                   {
                      clavecompara=codigo;
                                          idstat=jtable_modelo_facturacompleta.getValueAt(ii, 3).toString().replace("<html><b><font color=#CC0000>", "").replace("<html><b><font color=#FF6633>", "").replace("<html>", "");
                            if (idstat.equals(clavecompara))
                                {
                                    encontrado=1;
                                    cantiant=Float.valueOf(jtable_modelo_facturacompleta.getValueAt(ii, 1).toString());
                                    jtable_modelo_facturacompleta.setValueAt(miformat.format(Float.valueOf(cantidad)+cantiant),ii ,1);
                                }
                   }
                   if (opcionacumular==2)
                       {
                            clavecompara=controlalma;
                            idstat=jtable_modelo_facturacompleta.getValueAt(ii, 3).toString().replace("<html><b><font color=#CC0000>", "").replace("<html><b><font color=#FF6633>", "").replace("<html>", "");
                            if (idstat.equals(clavecompara))
                                {
                                    encontrado=1;
                                    cantiant=Float.valueOf(jtable_modelo_facturacompleta.getValueAt(ii, 1).toString());
                                    jtable_modelo_facturacompleta.setValueAt(miformat.format(Float.valueOf(cantidad)+cantiant),ii ,1);
                                }
                       }
                   if (opcionacumular==3)
                       {
                          clavecompara=item;
                          idstat=jtable_modelo_facturacompleta.getValueAt(ii, 3).toString().replace("<html><b><font color=#CC0000>", "").replace("<html><b><font color=#FF6633>", "").replace("<html>", "");
                          if (idstat.equals(clavecompara))
                            {
                                encontrado=1;
                                cantiant=Float.valueOf(jtable_modelo_facturacompleta.getValueAt(ii, 1).toString());
                                jtable_modelo_facturacompleta.setValueAt(miformat.format(Float.valueOf(cantidad)+cantiant),ii ,1);
                            }
                       }
                    if (opcionacumular==4)
                        {
                          clavecompara=controlalma;
                            idstat=jtable_modelo_facturacompleta.getValueAt(ii, 4).toString().replace("<html><b><font color=#CC0000>", "").replace("<html><b><font color=#FF6633>", "").replace("<html>", "");
                            if (idstat.equals(clavecompara))
                                {
                                    encontrado=1;
                                    cantiant=Float.valueOf(jtable_modelo_facturacompleta.getValueAt(ii, 1).toString());
                                    jtable_modelo_facturacompleta.setValueAt(miformat.format(Float.valueOf(cantidad)+cantiant),ii ,1);
                                }
                        }

                }
       if(encontrado==0)
            {
                if (opcionacumular==1)
                jtable_modelo_facturacompleta.addRow(new Object[]{folio,cantidad,descripcion,codigo,controlalma,costo,importe});
                if (opcionacumular==2)
                jtable_modelo_facturacompleta.addRow(new Object[]{folio,cantidad,descor,controlalma,controlalma,costo,importe});
                if (opcionacumular==3)
               jtable_modelo_facturacompleta.addRow(new Object[]{folio,cantidad,descripcion,item,controlalma,costo,importe});
                if (opcionacumular==4)
               jtable_modelo_facturacompleta.addRow(new Object[]{folio,cantidad,descripcion,codigo,controlalma,costo,importe});
            }
    }


private void dioclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
         System.out.println("dio doble  click");
         int fila = jtbl_facturasg.getSelectedRow();
         String shistori =jtbl_facturasg.getValueAt(fila, 12).toString().replace(";", "<br>");
         this.jep_historiprint.setText(shistori);
        //JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();

    }

    private String  fechaeuropea(String fecha) {
         //resibe cadena de fecha en formato americano yyyy-MM-dd
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;

    }

private String PesosMN(float total)
{
float lyCantidad=0, lyCentavos=0,totalf=0;
int lnDigito=0, lnPrimerDigito=0, lnSegundoDigito=0, lnTercerDigito=0,lnNumeroBloques=0,lnBloqueCero=0,I=0;
String lcBloque="",lcbloquefinal="",pesosmn="",pesosmnfinal="",importetexto="",importepartido[]=null;
DecimalFormat miformat = new DecimalFormat("###,###,###,###");
DecimalFormat miformatint = new DecimalFormat("############.##");
importetexto=miformatint.format(total);
importetexto=importetexto.replace(".", ":");
importepartido=importetexto.split(":");
//lyCantidad =  (int) (Math.round(total));
lyCantidad=Integer.valueOf(importepartido[0]);
//System.out.println("dividir Primero::"+lyCantidad+" ");
lyCentavos = (total-lyCantidad ) * 100;

String laUnidades[] = {"UN", "DOS", "TRES", "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE", "DIEZ", "ONCE", "DOCE", "TRECE", "CATORCE", "QUINCE", "DIECISEIS", "DIECISIETE", "DIECIOCHO", "DIECINUEVE", "VEINTE", "VEINTIUN", "VEINTIDOS", "VEINTITRES", "VEINTICUATRO", "VEINTICINCO", "VEINTISEIS", "VEINTISIETE", "VEINTIOCHO", "VEINTINUEVE"};
String laDecenas[] = {"DIEZ", "VEINTE", "TREINTA", "CUARENTA", "CINCUENTA", "SESENTA", "SETENTA", "OCHENTA", "NOVENTA"};
String laCentenas[] = {"CIENTO", "DOSCIENTOS", "TRESCIENTOS", "CUATROCIENTOS", "QUINIENTOS", "SEISCIENTOS", "SETECIENTOS", "OCHOCIENTOS", "NOVECIENTOS"};
lnNumeroBloques = 1;
do
{
    lnPrimerDigito = 0;
    lnSegundoDigito = 0;
    lnTercerDigito = 0;

    lcBloque = "";
    lnBloqueCero = 0;
    for(I=1;I<4;I++)
		{
			lnDigito =  (int) (lyCantidad % 10);
            //System.out.println("mod Primero::"+lnDigito+" For"+I);
			if (lnDigito != 0)
				{
					switch(I)
					{
						case 1:
							lcBloque = " " + laUnidades[lnDigito - 1];
							lnPrimerDigito = lnDigito;
						break;
                        case 2:
							if(lnDigito <= 2){
                                    lcBloque = "  " + laUnidades[(lnDigito * 10) + lnPrimerDigito - 1];
								}
							else{
                                    lcbloquefinal=lcBloque;
                                    lcBloque = "  " + laDecenas[lnDigito - 1];
                                    if(lnPrimerDigito != 0){
                                        	lcBloque+=" Y";
                                        }
									 lcBloque+=lcbloquefinal;
								}
								lnSegundoDigito = lnDigito;
						break;
                        case 3:
								lcbloquefinal=lcBloque;
								lcBloque = " ";
								if((lnDigito == 1) && (lnPrimerDigito == 0) && (lnSegundoDigito == 0)){
										lcBloque+="CIEN";
									}
									lcBloque+=laCentenas[lnDigito - 1];
									lcBloque+=lcbloquefinal;
                                    lnTercerDigito = lnDigito;
						break;
					}
				}
			else{
					lnBloqueCero = lnBloqueCero + 1;
				}
//System.out.println("dividir antes::"+lyCantidad+" ");
		lyCantidad = (int)(lyCantidad / 10);
//System.out.println("dividir despues::"+lyCantidad+" ");
		if(lyCantidad == 0){
            			I=3;
                        //System.out.println("Fin del For:"+lyCantidad+" ");
                }
	}//fin del for
	switch(lnNumeroBloques)
	{
		case 1:
			pesosmn = lcBloque;
		break;
		case 2:
			pesosmnfinal=pesosmn;
			pesosmn = lcBloque;
				if(lnBloqueCero == 3)
					{}
				else{
					pesosmn+=" MIL";
				}
				pesosmn+=pesosmnfinal;
		break;
		case 3:
			pesosmnfinal=pesosmn;
			pesosmn = lcBloque;
			if((lnPrimerDigito == 1) && (lnSegundoDigito == 0) && (lnTercerDigito == 0))
				{
				pesosmn+=" MILLON";
				}
			else
				{
				pesosmn+=" MILLONES";
				}
			pesosmn+=pesosmnfinal;
		break;
	}
    //System.out.println("bloque:"+lcBloque+" ");
	lnNumeroBloques = lnNumeroBloques + 1;
}
while(lyCantidad != 0);
pesosmn="" + pesosmn;
if( total > 1)
{
	pesosmn+=" PESOS ";
}
else
{
	pesosmn+=" PESO ";
}
pesosmn+=miformat.format(lyCentavos) + "/100 M.N.";
return pesosmn;
}

private void imprimirfactura(int pag,float ptotal)
    {
            this.objimpresora=new sie_impresiones();
            int margen=Integer.valueOf(this.jtf_fmargen.getText().toString());

     String facturar[]=this.jcbx_facturara.getSelectedItem().toString().split(":");

     this.objimpresora.setOneItem_cadenas_a_imprimir("   ");
     
     this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("   "+facturar[1]);
      for(int i = 0 ;i < margen; i++)
                {
                this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
                }
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                           "+this.jtf_ffecha.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                "+this.jtf_observaciones1.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                "+this.jtf_domcalle1.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                "+this.jtf_domcolonia1.getText()+" "+jtf_dompobla1.getText()+"                        "+this.jtf_rfc1.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                VENTA A CREDITO                                                                                                            "+this.jtf_cp.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("*");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                               "+this.jtf_metodopago.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                      "+this.jtf_importepesos.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                             "+this.jtf_fsubtotal.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                             "+this.jtf_fImpuesto.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                             "+this.jtf_ftotal.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    _");
    this.objimpresora.setOneItem_cadenas_a_imprimir("*");
    this.objimpresora.setObjeto_tabla(jt_formatofactura1);
    this.objimpresora.imprimir_all(11,pag);
    }



private void imprimirfacturan(int pag,float ptotal)
    {
            this.objimpresora=new sie_impresiones();
            int margen=Integer.valueOf(this.jtf_fmargen.getText().toString());

     String facturar[]=this.jcbx_facturara.getSelectedItem().toString().split(":");

     this.objimpresora.setOneItem_cadenas_a_imprimir("   ");

     this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("         ");
      for(int i = 0 ;i < margen; i++)
                {
                this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
                }
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                           "+this.jtf_ffecha.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                      "+String.format("%1$-100s",this.jtf_observaciones1.getText().toString())+" "+this.jtf_rfc1.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                      "+String.format("%1$-90s",this.jtf_domcalle1.getText().toString())+" "+this.jtf_cp.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                      "+String.format("%1$-60s",this.jtf_domcolonia1.getText().toString()+" "+jtf_dompobla1.getText())+"     VENTA A CREDITO ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                    "+this.jtf_metodopago.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("*");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                 ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                      "+this.jtf_importepesos.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                             "+this.jtf_fsubtotal.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                             "+this.jtf_fImpuesto.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                             "+this.jtf_ftotal.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    _");
    this.objimpresora.setOneItem_cadenas_a_imprimir("*");
    this.objimpresora.setObjeto_tabla(jt_formatofactura1);
    this.objimpresora.imprimir_all(11,pag);
    }

private void imprimirfactura2(int pag,float ptotal)
    {
            this.objimpresora=new sie_impresiones();
            int margen=Integer.valueOf(this.jtf_fmargen.getText().toString());

     String facturar[]=this.jcbx_facturara.getSelectedItem().toString().split(":");

     this.objimpresora.setOneItem_cadenas_a_imprimir("   ");

     this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("   "+facturar[1]);
      for(int i = 0 ;i < margen; i++)
                {
                this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
                }
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                           "+this.jtf_ffecha.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                "+this.jtf_observaciones1.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                "+this.jtf_domcalle1.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                "+this.jtf_domcolonia1.getText()+" "+jtf_dompobla1.getText()+"                        "+this.jtf_rfc1.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                VENTA A CREDITO                                                                                                            "+this.jtf_cp.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                   "+this.jtf_metodopago.getText());
    this.objimpresora.setOneItem_cadenas_a_imprimir("*");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                     ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                      "+this.jtf_importepesos.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                             "+this.jtf_fsubtotal.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                             "+this.jtf_fImpuesto.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    ");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                                                                                                                                                                             "+this.jtf_ftotal.getText()+"");
    this.objimpresora.setOneItem_cadenas_a_imprimir("                                    _");
    this.objimpresora.setOneItem_cadenas_a_imprimir("*");
    this.objimpresora.setObjeto_tabla(jt_formatofactura1);
    this.objimpresora.imprimir_all(11,pag);
    }

    private void carga_datos_facturapaginacion(int pagina)
    {
        while(jtable_modelo_facturabloque.getRowCount()>0)jtable_modelo_facturabloque.removeRow(0);
        Object[] fnewRowdet = new Object[8];
        int nif=0,pag=pagina,nobjetotabla=this.jtable_modelo_facturacompleta.getRowCount(),nip=0,ni=0,fila=0,artxpag=Integer.valueOf(this.jtf_fotosartxpag.getText().toString()),sobrante;
             nif=((pag+1)*artxpag);
             nip=((pag)*artxpag);
                        if (nif < nobjetotabla )
                            {
                                nobjetotabla=nif;
                            }
                    /*Impresion de los productos*/
                        for(ni=nip;ni<nobjetotabla;ni++)
                        {
                                fnewRowdet[0]=jtable_modelo_facturacompleta.getValueAt(ni, 1).toString();
                                fnewRowdet[1]=jtable_modelo_facturacompleta.getValueAt(ni, 2).toString();
                                fnewRowdet[2]=jtable_modelo_facturacompleta.getValueAt(ni, 3).toString();
                                fnewRowdet[3]=jtable_modelo_facturacompleta.getValueAt(ni, 4).toString();
                                fnewRowdet[4]=jtable_modelo_facturacompleta.getValueAt(ni, 5).toString();
                                fnewRowdet[5]=this.jtf_fdesc.getText();
                                fnewRowdet[6]=this.jtf_fpimpu.getText();
                                fnewRowdet[7]="0";
                                jtable_modelo_facturabloque.addRow(fnewRowdet);
                        }
      this.calcularimportesfactura();
    }

private void paginas()
    {
        float totalpaginas=0,dif=0,artxpag=Float.valueOf(this.jtf_fotosartxpag.getText().toString());
        if(this.jt_formatofactura2.getRowCount()<=artxpag)
            {
                totalpaginas=1;
            }
        else
            {
                totalpaginas=this.jt_formatofactura2.getRowCount()/artxpag;
            }
        String paginastexto="",paginaspartido[]=null,paginasreplace="";
        DecimalFormat miformatint = new DecimalFormat("############");
        paginastexto=miformatint.format(totalpaginas);
        paginasreplace=String.valueOf(totalpaginas).replace(".", ":");
        paginaspartido=paginasreplace.split(":");
        dif=totalpaginas-Float.valueOf(paginastexto);
        System.out.println("pagina y fracc:"+totalpaginas+" pagina:"+paginaspartido[0]+" registros:"+this.jtable_modelo_facturacompleta.getRowCount());

        if (dif != 0)
            {
                totalpaginas=Float.valueOf(paginaspartido[0])+1;
            }
        else
            {
                totalpaginas=Float.valueOf(paginastexto);
            }
        this.jlbl_paginas.setText("PAGINAS :"+totalpaginas);
    }
 private void jlst_clientesdistribucionMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel13 = new javax.swing.JPanel();
        jScrollPane11 = new javax.swing.JScrollPane();
        jlst_clientesdistribucion = new javax.swing.JList();
        jPanel14 = new javax.swing.JPanel();
        jtf_cliente = new javax.swing.JTextField();
        jLabel39 = new javax.swing.JLabel();
        jtf_observaciones1 = new javax.swing.JTextField();
        jtf_idcliente1 = new javax.swing.JTextField();
        jLabel40 = new javax.swing.JLabel();
        jtf_dompobla1 = new javax.swing.JTextField();
        jtf_cp = new javax.swing.JTextField();
        jtf_domcalle1 = new javax.swing.JTextField();
        jLabel41 = new javax.swing.JLabel();
        jLabel42 = new javax.swing.JLabel();
        jLabel43 = new javax.swing.JLabel();
        jLabel44 = new javax.swing.JLabel();
        jtf_domcolonia1 = new javax.swing.JTextField();
        jLabel45 = new javax.swing.JLabel();
        jtf_email2 = new javax.swing.JTextField();
        jtf_direccion3 = new javax.swing.JTextField();
        jLabel46 = new javax.swing.JLabel();
        jtf_rfc1 = new javax.swing.JTextField();
        jLabel47 = new javax.swing.JLabel();
        jtf_tel = new javax.swing.JTextField();
        jLabel48 = new javax.swing.JLabel();
        jLabel49 = new javax.swing.JLabel();
        jtf_atnventas = new javax.swing.JTextField();
        jLabel50 = new javax.swing.JLabel();
        jtf_atncobra = new javax.swing.JTextField();
        jtf_ffecha = new javax.swing.JTextField();
        jLabel54 = new javax.swing.JLabel();
        jtf_fdesc = new javax.swing.JTextField();
        jLabel55 = new javax.swing.JLabel();
        jtf_fpimpu = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jcbx_facturara = new javax.swing.JComboBox();
        jtf_metodopago = new javax.swing.JTextField();
        jLabel61 = new javax.swing.JLabel();
        jcbx_nuevaformato = new javax.swing.JCheckBox();
        jScrollPane12 = new javax.swing.JScrollPane();
        jt_formatofactura1 = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                if (mColIndex < 6)
                return false;
                else
                return true;
            }
        }
        ;
        jScrollPane13 = new javax.swing.JScrollPane();
        jt_formatofactura2 = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                if ((mColIndex == 0)||(mColIndex == 4)||(mColIndex == 6))
                return false;
                else
                return true;
            }
        }
        ;
        jtf_fsubtotal = new javax.swing.JTextField();
        jtf_fImpuesto = new javax.swing.JTextField();
        jtf_ftotal = new javax.swing.JTextField();
        jLabel51 = new javax.swing.JLabel();
        jLabel52 = new javax.swing.JLabel();
        jLabel53 = new javax.swing.JLabel();
        jtf_fotosartxpag = new javax.swing.JTextField();
        jlbl_paginas = new javax.swing.JLabel();
        jbtn_anterior = new javax.swing.JButton();
        jtf_paginaactual = new javax.swing.JTextField();
        jbtn_siguiente = new javax.swing.JButton();
        jlbl_paginas1 = new javax.swing.JLabel();
        jLabel56 = new javax.swing.JLabel();
        jtf_fdescuento = new javax.swing.JTextField();
        jbtn_imprimir = new javax.swing.JButton();
        jtf_importepesos = new javax.swing.JTextField();
        jtf_fmargen = new javax.swing.JTextField();
        jLabel57 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jrbtn_recepcion = new javax.swing.JRadioButton();
        jrbtn_credito = new javax.swing.JRadioButton();
        jrbtn_traspaso = new javax.swing.JRadioButton();
        jrbtn_movextra = new javax.swing.JRadioButton();
        jLabel2 = new javax.swing.JLabel();
        jtf_busqueda = new javax.swing.JTextField();
        jbtn_busqueda = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jcbx_tiendas = new javax.swing.JComboBox();
        jrbtn_pedido = new javax.swing.JRadioButton();
        jLabel4 = new javax.swing.JLabel();
        jrbtn_importecosto = new javax.swing.JRadioButton();
        jLabel6 = new javax.swing.JLabel();
        jrbtn_importeprecio = new javax.swing.JRadioButton();
        jcbx_acumfolios = new javax.swing.JCheckBox();
        jtf_folioactual = new javax.swing.JTextField();
        jrbtn_acucodigo = new javax.swing.JRadioButton();
        jrbtn_acuitempr = new javax.swing.JRadioButton();
        jrbtn_acucodigo1 = new javax.swing.JRadioButton();
        jrbtn_acucodigo2 = new javax.swing.JRadioButton();
        jLabel5 = new javax.swing.JLabel();
        jtf_fsubtotalgral = new javax.swing.JTextField();
        jLabel58 = new javax.swing.JLabel();
        jtf_fdescuentogral = new javax.swing.JTextField();
        jLabel59 = new javax.swing.JLabel();
        jtf_fImpuestogral = new javax.swing.JTextField();
        jLabel60 = new javax.swing.JLabel();
        jtf_ftotalgral = new javax.swing.JTextField();
        jtf_fotosartxpag1 = new javax.swing.JTextField();
        jlbl_paginas2 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jtbl_facturasg = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        };
        jScrollPane1 = new javax.swing.JScrollPane();
        jep_historiprint = new javax.swing.JEditorPane();
        jLabel7 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane14 = new javax.swing.JScrollPane();
        jta_archivo = new javax.swing.JEditorPane();
        jLabel89 = new javax.swing.JLabel();
        jbtn_importarfile = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jmni_escape = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jmni_nuevafactura = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jmni_imprimir_gpo = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(ventas_sie_impresionfacturas.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jTabbedPane1.setName("jTabbedPane1"); // NOI18N
        jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jTabbedPane1StateChanged(evt);
            }
        });

        jPanel13.setName("jPanel13"); // NOI18N

        jScrollPane11.setName("jScrollPane11"); // NOI18N

        jlst_clientesdistribucion.setModel(this.modelo);
        jlst_clientesdistribucion.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jlst_clientesdistribucion.setToolTipText(resourceMap.getString("jlst_clientesdistribucion.toolTipText")); // NOI18N
        jlst_clientesdistribucion.setName("jlst_clientesdistribucion"); // NOI18N
        jlst_clientesdistribucion.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlst_clientesdistribucionMouseClicked(evt);
                if(evt.getClickCount() >= 1)
                {
                    dioclickfactura(evt);
                }
            }
        });
        jScrollPane11.setViewportView(jlst_clientesdistribucion);

        jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel14.border.title"))); // NOI18N
        jPanel14.setName("jPanel14"); // NOI18N

        jtf_cliente.setName("jtf_cliente"); // NOI18N
        jtf_cliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_clienteActionPerformed(evt);
            }
        });

        jLabel39.setText(resourceMap.getString("jLabel39.text")); // NOI18N
        jLabel39.setName("jLabel39"); // NOI18N

        jtf_observaciones1.setName("jtf_observaciones1"); // NOI18N
        jtf_observaciones1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_observaciones1ActionPerformed(evt);
            }
        });

        jtf_idcliente1.setText(resourceMap.getString("jtf_idcliente1.text")); // NOI18N
        jtf_idcliente1.setToolTipText(resourceMap.getString("jtf_idcliente1.toolTipText")); // NOI18N
        jtf_idcliente1.setAutoscrolls(false);
        jtf_idcliente1.setName("jtf_idcliente1"); // NOI18N
        jtf_idcliente1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_idcliente1ActionPerformed(evt);
            }
        });

        jLabel40.setText(resourceMap.getString("jLabel40.text")); // NOI18N
        jLabel40.setName("jLabel40"); // NOI18N

        jtf_dompobla1.setName("jtf_dompobla1"); // NOI18N
        jtf_dompobla1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_dompobla1ActionPerformed(evt);
            }
        });

        jtf_cp.setName("jtf_cp"); // NOI18N
        jtf_cp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_cpActionPerformed(evt);
            }
        });

        jtf_domcalle1.setName("jtf_domcalle1"); // NOI18N
        jtf_domcalle1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_domcalle1ActionPerformed(evt);
            }
        });

        jLabel41.setText(resourceMap.getString("jLabel41.text")); // NOI18N
        jLabel41.setName("jLabel41"); // NOI18N

        jLabel42.setText(resourceMap.getString("jLabel42.text")); // NOI18N
        jLabel42.setName("jLabel42"); // NOI18N

        jLabel43.setText(resourceMap.getString("jLabel43.text")); // NOI18N
        jLabel43.setName("jLabel43"); // NOI18N

        jLabel44.setText(resourceMap.getString("jLabel44.text")); // NOI18N
        jLabel44.setName("jLabel44"); // NOI18N

        jtf_domcolonia1.setName("jtf_domcolonia1"); // NOI18N
        jtf_domcolonia1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_domcolonia1ActionPerformed(evt);
            }
        });

        jLabel45.setText(resourceMap.getString("jLabel45.text")); // NOI18N
        jLabel45.setName("jLabel45"); // NOI18N

        jtf_email2.setName("jtf_email2"); // NOI18N
        jtf_email2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_email2ActionPerformed(evt);
            }
        });

        jtf_direccion3.setName("jtf_direccion3"); // NOI18N
        jtf_direccion3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_direccion3ActionPerformed(evt);
            }
        });

        jLabel46.setText(resourceMap.getString("jLabel46.text")); // NOI18N
        jLabel46.setName("jLabel46"); // NOI18N

        jtf_rfc1.setName("jtf_rfc1"); // NOI18N
        jtf_rfc1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_rfc1ActionPerformed(evt);
            }
        });

        jLabel47.setText(resourceMap.getString("jLabel47.text")); // NOI18N
        jLabel47.setName("jLabel47"); // NOI18N

        jtf_tel.setName("jtf_tel"); // NOI18N
        jtf_tel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_telActionPerformed(evt);
            }
        });

        jLabel48.setText(resourceMap.getString("jLabel48.text")); // NOI18N
        jLabel48.setName("jLabel48"); // NOI18N

        jLabel49.setText(resourceMap.getString("jLabel49.text")); // NOI18N
        jLabel49.setName("jLabel49"); // NOI18N

        jtf_atnventas.setName("jtf_atnventas"); // NOI18N
        jtf_atnventas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_atnventasActionPerformed(evt);
            }
        });

        jLabel50.setText(resourceMap.getString("jLabel50.text")); // NOI18N
        jLabel50.setName("jLabel50"); // NOI18N

        jtf_atncobra.setName("jtf_atncobra"); // NOI18N
        jtf_atncobra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_atncobraActionPerformed(evt);
            }
        });

        jtf_ffecha.setAutoscrolls(false);
        jtf_ffecha.setName("jtf_ffecha"); // NOI18N

        jLabel54.setText(resourceMap.getString("jLabel54.text")); // NOI18N
        jLabel54.setName("jLabel54"); // NOI18N

        jtf_fdesc.setText(resourceMap.getString("jtf_fdesc.text")); // NOI18N
        jtf_fdesc.setToolTipText(resourceMap.getString("jtf_fdesc.toolTipText")); // NOI18N
        jtf_fdesc.setName("jtf_fdesc"); // NOI18N

        jLabel55.setText(resourceMap.getString("jLabel55.text")); // NOI18N
        jLabel55.setName("jLabel55"); // NOI18N

        jtf_fpimpu.setText(resourceMap.getString("jtf_fpimpu.text")); // NOI18N
        jtf_fpimpu.setToolTipText(resourceMap.getString("jtf_fpimpu.toolTipText")); // NOI18N
        jtf_fpimpu.setName("jtf_fpimpu"); // NOI18N
        jtf_fpimpu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_fpimpuActionPerformed(evt);
            }
        });

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jcbx_facturara.setToolTipText(resourceMap.getString("jcbx_facturara.toolTipText")); // NOI18N
        jcbx_facturara.setName("jcbx_facturara"); // NOI18N
        jcbx_facturara.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_facturaraActionPerformed(evt);
            }
        });

        jtf_metodopago.setText(resourceMap.getString("jtf_metodopago.text")); // NOI18N
        jtf_metodopago.setToolTipText(resourceMap.getString("jtf_metodopago.toolTipText")); // NOI18N
        jtf_metodopago.setName("jtf_metodopago"); // NOI18N
        jtf_metodopago.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_metodopagoActionPerformed(evt);
            }
        });

        jLabel61.setText(resourceMap.getString("jLabel61.text")); // NOI18N
        jLabel61.setName("jLabel61"); // NOI18N

        jcbx_nuevaformato.setText(resourceMap.getString("jcbx_nuevaformato.text")); // NOI18N
        jcbx_nuevaformato.setName("jcbx_nuevaformato"); // NOI18N

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel14Layout.createSequentialGroup()
                        .addComponent(jLabel39)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_domcolonia1, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel43)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_dompobla1, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel45)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_email2, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(117, 117, 117))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel14Layout.createSequentialGroup()
                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel14Layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jtf_ffecha, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_idcliente1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel41, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, 338, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel44)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_domcalle1, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(96, 96, 96))
                            .addGroup(jPanel14Layout.createSequentialGroup()
                                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel14Layout.createSequentialGroup()
                                        .addComponent(jLabel40)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_cp, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel47)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_rfc1, javax.swing.GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel48)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_tel, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel46)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_direccion3, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel14Layout.createSequentialGroup()
                                        .addGap(4, 4, 4)
                                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jPanel14Layout.createSequentialGroup()
                                                .addComponent(jLabel49)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(jtf_atnventas, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jLabel50)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jtf_atncobra, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jLabel42))
                                            .addGroup(jPanel14Layout.createSequentialGroup()
                                                .addComponent(jLabel8)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jcbx_facturara, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jLabel61)))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addGroup(jPanel14Layout.createSequentialGroup()
                                                .addComponent(jtf_observaciones1, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(18, 18, 18)
                                                .addComponent(jLabel55))
                                            .addComponent(jtf_metodopago))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jPanel14Layout.createSequentialGroup()
                                                .addComponent(jtf_fdesc, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jLabel54)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jtf_fpimpu, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE))
                                            .addGroup(jPanel14Layout.createSequentialGroup()
                                                .addGap(10, 10, 10)
                                                .addComponent(jcbx_nuevaformato)))))
                                .addGap(97, 97, 97)))
                        .addGap(12, 12, 12)))
                .addContainerGap())
        );
        jPanel14Layout.setVerticalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_idcliente1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel41)
                    .addComponent(jtf_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_ffecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel44)
                    .addComponent(jtf_domcalle1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel39)
                    .addComponent(jtf_domcolonia1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel43)
                    .addComponent(jtf_dompobla1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_email2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel45))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel46)
                    .addComponent(jtf_direccion3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel40)
                    .addComponent(jtf_cp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel47)
                    .addComponent(jtf_rfc1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_tel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel48))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_atnventas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel50)
                    .addComponent(jtf_atncobra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel42)
                    .addComponent(jtf_observaciones1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel49)
                    .addComponent(jLabel55)
                    .addComponent(jtf_fdesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel54)
                    .addComponent(jtf_fpimpu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jcbx_facturara, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_metodopago, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel61)
                    .addComponent(jcbx_nuevaformato))
                .addContainerGap())
        );

        jScrollPane12.setName("jScrollPane12"); // NOI18N

        jt_formatofactura1.setModel(this.jtable_modelo_facturabloque);
        jt_formatofactura1.setName("jt_formatofactura1"); // NOI18N
        // TODO add your handling code here:
        jScrollPane12.setViewportView(jt_formatofactura1);

        jScrollPane13.setName("jScrollPane13"); // NOI18N

        jt_formatofactura2.setModel(this.jtable_modelo_facturacompleta);
        jt_formatofactura2.setName("jt_formatofactura2"); // NOI18N
        // TODO add your handling code here:
        jt_formatofactura2.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jt_formatofactura2PropertyChange(evt);
            }
        });
        jScrollPane13.setViewportView(jt_formatofactura2);

        jtf_fsubtotal.setEditable(false);
        jtf_fsubtotal.setFont(resourceMap.getFont("jtf_fsubtotal.font")); // NOI18N
        jtf_fsubtotal.setName("jtf_fsubtotal"); // NOI18N

        jtf_fImpuesto.setEditable(false);
        jtf_fImpuesto.setName("jtf_fImpuesto"); // NOI18N

        jtf_ftotal.setEditable(false);
        jtf_ftotal.setFont(resourceMap.getFont("jtf_ftotal.font")); // NOI18N
        jtf_ftotal.setName("jtf_ftotal"); // NOI18N

        jLabel51.setText(resourceMap.getString("jLabel51.text")); // NOI18N
        jLabel51.setName("jLabel51"); // NOI18N

        jLabel52.setText(resourceMap.getString("jLabel52.text")); // NOI18N
        jLabel52.setName("jLabel52"); // NOI18N

        jLabel53.setText(resourceMap.getString("jLabel53.text")); // NOI18N
        jLabel53.setName("jLabel53"); // NOI18N

        jtf_fotosartxpag.setText(resourceMap.getString("jtf_fotosartxpag.text")); // NOI18N
        jtf_fotosartxpag.setToolTipText(resourceMap.getString("jtf_fotosartxpag.toolTipText")); // NOI18N
        jtf_fotosartxpag.setName("jtf_fotosartxpag"); // NOI18N
        jtf_fotosartxpag.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_fotosartxpagActionPerformed(evt);
            }
        });

        jlbl_paginas.setFont(resourceMap.getFont("jlbl_paginas.font")); // NOI18N
        jlbl_paginas.setText(resourceMap.getString("jlbl_paginas.text")); // NOI18N
        jlbl_paginas.setName("jlbl_paginas"); // NOI18N

        jbtn_anterior.setIcon(resourceMap.getIcon("jbtn_anterior.icon")); // NOI18N
        jbtn_anterior.setText(resourceMap.getString("jbtn_anterior.text")); // NOI18N
        jbtn_anterior.setName("jbtn_anterior"); // NOI18N
        jbtn_anterior.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_anteriorActionPerformed(evt);
            }
        });

        jtf_paginaactual.setText(resourceMap.getString("jtf_paginaactual.text")); // NOI18N
        jtf_paginaactual.setToolTipText(resourceMap.getString("jtf_paginaactual.toolTipText")); // NOI18N
        jtf_paginaactual.setName("jtf_paginaactual"); // NOI18N
        jtf_paginaactual.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_paginaactualActionPerformed(evt);
            }
        });

        jbtn_siguiente.setIcon(resourceMap.getIcon("jbtn_siguiente.icon")); // NOI18N
        jbtn_siguiente.setText(resourceMap.getString("jbtn_siguiente.text")); // NOI18N
        jbtn_siguiente.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        jbtn_siguiente.setName("jbtn_siguiente"); // NOI18N
        jbtn_siguiente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_siguienteActionPerformed(evt);
            }
        });

        jlbl_paginas1.setText(resourceMap.getString("jlbl_paginas1.text")); // NOI18N
        jlbl_paginas1.setName("jlbl_paginas1"); // NOI18N

        jLabel56.setText(resourceMap.getString("jLabel56.text")); // NOI18N
        jLabel56.setName("jLabel56"); // NOI18N

        jtf_fdescuento.setEditable(false);
        jtf_fdescuento.setName("jtf_fdescuento"); // NOI18N

        jbtn_imprimir.setIcon(resourceMap.getIcon("jbtn_imprimir.icon")); // NOI18N
        jbtn_imprimir.setText(resourceMap.getString("jbtn_imprimir.text")); // NOI18N
        jbtn_imprimir.setName("jbtn_imprimir"); // NOI18N
        jbtn_imprimir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_imprimirActionPerformed(evt);
            }
        });

        jtf_importepesos.setName("jtf_importepesos"); // NOI18N

        jtf_fmargen.setText(resourceMap.getString("jtf_fmargen.text")); // NOI18N
        jtf_fmargen.setToolTipText(resourceMap.getString("jtf_fmargen.toolTipText")); // NOI18N
        jtf_fmargen.setName("jtf_fmargen"); // NOI18N
        jtf_fmargen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_fmargenActionPerformed(evt);
            }
        });

        jLabel57.setText(resourceMap.getString("jLabel57.text")); // NOI18N
        jLabel57.setToolTipText(resourceMap.getString("jLabel57.toolTipText")); // NOI18N
        jLabel57.setName("jLabel57"); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N

        buttonGroup1.add(jrbtn_recepcion);
        jrbtn_recepcion.setText(resourceMap.getString("jrbtn_recepcion.text")); // NOI18N
        jrbtn_recepcion.setToolTipText(resourceMap.getString("jrbtn_recepcion.toolTipText")); // NOI18N
        jrbtn_recepcion.setActionCommand(resourceMap.getString("jrbtn_recepcion.actionCommand")); // NOI18N
        jrbtn_recepcion.setName("jrbtn_recepcion"); // NOI18N
        jrbtn_recepcion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_recepcionActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_credito);
        jrbtn_credito.setText(resourceMap.getString("jrbtn_credito.text")); // NOI18N
        jrbtn_credito.setToolTipText(resourceMap.getString("jrbtn_credito.toolTipText")); // NOI18N
        jrbtn_credito.setActionCommand(resourceMap.getString("jrbtn_credito.actionCommand")); // NOI18N
        jrbtn_credito.setName("jrbtn_credito"); // NOI18N
        jrbtn_credito.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_creditoActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_traspaso);
        jrbtn_traspaso.setText(resourceMap.getString("jrbtn_traspaso.text")); // NOI18N
        jrbtn_traspaso.setToolTipText(resourceMap.getString("jrbtn_traspaso.toolTipText")); // NOI18N
        jrbtn_traspaso.setActionCommand(resourceMap.getString("jrbtn_traspaso.actionCommand")); // NOI18N
        jrbtn_traspaso.setName("jrbtn_traspaso"); // NOI18N
        jrbtn_traspaso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_traspasoActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_movextra);
        jrbtn_movextra.setText(resourceMap.getString("jrbtn_movextra.text")); // NOI18N
        jrbtn_movextra.setToolTipText(resourceMap.getString("jrbtn_movextra.toolTipText")); // NOI18N
        jrbtn_movextra.setActionCommand(resourceMap.getString("jrbtn_movextra.actionCommand")); // NOI18N
        jrbtn_movextra.setName("jrbtn_movextra"); // NOI18N
        jrbtn_movextra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_movextraActionPerformed(evt);
            }
        });

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jtf_busqueda.setToolTipText(resourceMap.getString("jtf_busqueda.toolTipText")); // NOI18N
        jtf_busqueda.setName("jtf_busqueda"); // NOI18N
        jtf_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_busquedaActionPerformed(evt);
            }
        });

        jbtn_busqueda.setIcon(resourceMap.getIcon("jbtn_busqueda.icon")); // NOI18N
        jbtn_busqueda.setText(resourceMap.getString("jbtn_busqueda.text")); // NOI18N
        jbtn_busqueda.setToolTipText(resourceMap.getString("jbtn_busqueda.toolTipText")); // NOI18N
        jbtn_busqueda.setName("jbtn_busqueda"); // NOI18N
        jbtn_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_busquedaActionPerformed(evt);
            }
        });

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jcbx_tiendas.setToolTipText(resourceMap.getString("jcbx_tiendas.toolTipText")); // NOI18N
        jcbx_tiendas.setName("jcbx_tiendas"); // NOI18N
        jcbx_tiendas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_tiendasActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_pedido);
        jrbtn_pedido.setText(resourceMap.getString("jrbtn_pedido.text")); // NOI18N
        jrbtn_pedido.setToolTipText(resourceMap.getString("jrbtn_pedido.toolTipText")); // NOI18N
        jrbtn_pedido.setActionCommand(resourceMap.getString("jrbtn_pedido.actionCommand")); // NOI18N
        jrbtn_pedido.setName("jrbtn_pedido"); // NOI18N
        jrbtn_pedido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_pedidoActionPerformed(evt);
            }
        });

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        buttonGroup2.add(jrbtn_importecosto);
        jrbtn_importecosto.setText(resourceMap.getString("jrbtn_importecosto.text")); // NOI18N
        jrbtn_importecosto.setToolTipText(resourceMap.getString("jrbtn_importecosto.toolTipText")); // NOI18N
        jrbtn_importecosto.setActionCommand(resourceMap.getString("jrbtn_importecosto.actionCommand")); // NOI18N
        jrbtn_importecosto.setName("jrbtn_importecosto"); // NOI18N
        jrbtn_importecosto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_importecostoActionPerformed(evt);
            }
        });

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        buttonGroup2.add(jrbtn_importeprecio);
        jrbtn_importeprecio.setText(resourceMap.getString("jrbtn_importeprecio.text")); // NOI18N
        jrbtn_importeprecio.setToolTipText(resourceMap.getString("jrbtn_importeprecio.toolTipText")); // NOI18N
        jrbtn_importeprecio.setActionCommand(resourceMap.getString("jrbtn_importeprecio.actionCommand")); // NOI18N
        jrbtn_importeprecio.setName("jrbtn_importeprecio"); // NOI18N
        jrbtn_importeprecio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_importeprecioActionPerformed(evt);
            }
        });

        jcbx_acumfolios.setText(resourceMap.getString("jcbx_acumfolios.text")); // NOI18N
        jcbx_acumfolios.setToolTipText(resourceMap.getString("jcbx_acumfolios.toolTipText")); // NOI18N
        jcbx_acumfolios.setName("jcbx_acumfolios"); // NOI18N
        jcbx_acumfolios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_acumfoliosActionPerformed(evt);
            }
        });

        jtf_folioactual.setEditable(false);
        jtf_folioactual.setText(resourceMap.getString("jtf_folioactual.text")); // NOI18N
        jtf_folioactual.setName("jtf_folioactual"); // NOI18N

        buttonGroup3.add(jrbtn_acucodigo);
        jrbtn_acucodigo.setText(resourceMap.getString("jrbtn_acucodigo.text")); // NOI18N
        jrbtn_acucodigo.setActionCommand(resourceMap.getString("jrbtn_acucodigo.actionCommand")); // NOI18N
        jrbtn_acucodigo.setName("jrbtn_acucodigo"); // NOI18N
        jrbtn_acucodigo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_acucodigoActionPerformed(evt);
            }
        });

        buttonGroup3.add(jrbtn_acuitempr);
        jrbtn_acuitempr.setText(resourceMap.getString("jrbtn_acuitempr.text")); // NOI18N
        jrbtn_acuitempr.setActionCommand(resourceMap.getString("jrbtn_acuitempr.actionCommand")); // NOI18N
        jrbtn_acuitempr.setName("jrbtn_acuitempr"); // NOI18N
        jrbtn_acuitempr.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_acuitemprActionPerformed(evt);
            }
        });

        buttonGroup3.add(jrbtn_acucodigo1);
        jrbtn_acucodigo1.setText(resourceMap.getString("jrbtn_acucodigo1.text")); // NOI18N
        jrbtn_acucodigo1.setActionCommand(resourceMap.getString("jrbtn_acucodigo1.actionCommand")); // NOI18N
        jrbtn_acucodigo1.setName("jrbtn_acucodigo1"); // NOI18N
        jrbtn_acucodigo1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_acucodigo1ActionPerformed(evt);
            }
        });

        buttonGroup3.add(jrbtn_acucodigo2);
        jrbtn_acucodigo2.setText(resourceMap.getString("jrbtn_acucodigo2.text")); // NOI18N
        jrbtn_acucodigo2.setActionCommand(resourceMap.getString("jrbtn_acucodigo2.actionCommand")); // NOI18N
        jrbtn_acucodigo2.setName("jrbtn_acucodigo2"); // NOI18N
        jrbtn_acucodigo2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_acucodigo2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_importecosto)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_importeprecio)
                        .addGap(18, 18, 18)
                        .addComponent(jcbx_acumfolios)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel3)
                        .addGap(18, 18, 18)
                        .addComponent(jrbtn_recepcion)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_credito, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_traspaso)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_movextra)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_pedido)
                        .addGap(225, 225, 225))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtn_busqueda)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_folioactual, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_acucodigo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_acuitempr)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_acucodigo1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_acucodigo2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jrbtn_importecosto, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_importeprecio, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcbx_acumfolios, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(jrbtn_credito, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_recepcion, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_traspaso, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_movextra, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_pedido, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jbtn_busqueda)
                            .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1)
                            .addComponent(jtf_folioactual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jrbtn_acucodigo)
                            .addComponent(jrbtn_acuitempr)
                            .addComponent(jrbtn_acucodigo1)
                            .addComponent(jrbtn_acucodigo2))
                        .addGap(22, 22, 22))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(37, 37, 37))))
        );

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jtf_fsubtotalgral.setEditable(false);
        jtf_fsubtotalgral.setFont(resourceMap.getFont("jtf_fsubtotalgral.font")); // NOI18N
        jtf_fsubtotalgral.setName("jtf_fsubtotalgral"); // NOI18N

        jLabel58.setText(resourceMap.getString("jLabel58.text")); // NOI18N
        jLabel58.setName("jLabel58"); // NOI18N

        jtf_fdescuentogral.setEditable(false);
        jtf_fdescuentogral.setName("jtf_fdescuentogral"); // NOI18N

        jLabel59.setText(resourceMap.getString("jLabel59.text")); // NOI18N
        jLabel59.setName("jLabel59"); // NOI18N

        jtf_fImpuestogral.setEditable(false);
        jtf_fImpuestogral.setName("jtf_fImpuestogral"); // NOI18N

        jLabel60.setText(resourceMap.getString("jLabel60.text")); // NOI18N
        jLabel60.setName("jLabel60"); // NOI18N

        jtf_ftotalgral.setEditable(false);
        jtf_ftotalgral.setFont(resourceMap.getFont("jtf_ftotalgral.font")); // NOI18N
        jtf_ftotalgral.setName("jtf_ftotalgral"); // NOI18N

        jtf_fotosartxpag1.setText(resourceMap.getString("jtf_fotosartxpag1.text")); // NOI18N
        jtf_fotosartxpag1.setToolTipText(resourceMap.getString("jtf_fotosartxpag1.toolTipText")); // NOI18N
        jtf_fotosartxpag1.setName("jtf_fotosartxpag1"); // NOI18N
        jtf_fotosartxpag1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_fotosartxpag1ActionPerformed(evt);
            }
        });

        jlbl_paginas2.setFont(resourceMap.getFont("jlbl_paginas2.font")); // NOI18N
        jlbl_paginas2.setText(resourceMap.getString("jlbl_paginas2.text")); // NOI18N
        jlbl_paginas2.setToolTipText(resourceMap.getString("jlbl_paginas2.toolTipText")); // NOI18N
        jlbl_paginas2.setName("jlbl_paginas2"); // NOI18N

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel13Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel13Layout.createSequentialGroup()
                                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel13Layout.createSequentialGroup()
                                        .addComponent(jbtn_anterior)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_paginaactual, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel13Layout.createSequentialGroup()
                                        .addComponent(jLabel57)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_fmargen, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jlbl_paginas1)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_fotosartxpag)))
                                .addGap(4, 4, 4)
                                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jbtn_siguiente, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jPanel13Layout.createSequentialGroup()
                                        .addComponent(jlbl_paginas)
                                        .addGap(11, 11, 11)
                                        .addComponent(jlbl_paginas2)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_fotosartxpag1, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                                .addGap(6, 6, 6)
                                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel13Layout.createSequentialGroup()
                                        .addComponent(jLabel5)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_fsubtotalgral, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel58)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_fdescuentogral, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel13Layout.createSequentialGroup()
                                        .addComponent(jLabel59)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_fImpuestogral, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel60)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jtf_ftotalgral, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addComponent(jScrollPane13))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel13Layout.createSequentialGroup()
                                .addComponent(jtf_importepesos, javax.swing.GroupLayout.PREFERRED_SIZE, 328, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jbtn_imprimir))
                            .addGroup(jPanel13Layout.createSequentialGroup()
                                .addComponent(jLabel51)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_fsubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel56)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_fdescuento, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel52)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_fImpuesto, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel53)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_ftotal, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel13Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, 845, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel1, 0, 976, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel13Layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE)
                    .addComponent(jScrollPane12, 0, 0, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel57)
                    .addComponent(jtf_fmargen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl_paginas1)
                    .addComponent(jtf_fotosartxpag, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jtf_fsubtotalgral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_fdescuentogral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel58)
                    .addComponent(jtf_fsubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel51)
                    .addComponent(jtf_fdescuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel56)
                    .addComponent(jtf_ftotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_fImpuesto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel52)
                    .addComponent(jLabel53)
                    .addComponent(jlbl_paginas)
                    .addComponent(jtf_fotosartxpag1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl_paginas2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtn_anterior)
                    .addComponent(jtf_paginaactual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtn_siguiente)
                    .addComponent(jtf_fImpuestogral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel59)
                    .addComponent(jLabel60)
                    .addComponent(jtf_ftotalgral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_importepesos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtn_imprimir))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Facturar", jPanel13);

        jPanel2.setName("jPanel2"); // NOI18N

        jPanel3.setName("jPanel3"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jtbl_facturasg.setModel(this.jtable_modelo_facturas);
        jtbl_facturasg.setName("jtbl_facturasg"); // NOI18N
        jtbl_facturasg.getTableHeader().setReorderingAllowed(false);
        jtbl_facturasg.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jtbl_facturasgMouseClicked(evt);
                if(evt.getClickCount() >= 1)
                {
                    dioclick(evt);
                    //System.out.println(" double click" );

                }
            }
        });
        jScrollPane2.setViewportView(jtbl_facturasg);

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jep_historiprint.setContentType(resourceMap.getString("jep_historiprint.contentType")); // NOI18N
        jep_historiprint.setName("jep_historiprint"); // NOI18N
        jScrollPane1.setViewportView(jep_historiprint);

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(480, Short.MAX_VALUE))
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 976, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N

        jPanel4.setName("jPanel4"); // NOI18N

        jPanel5.setName("jPanel5"); // NOI18N

        jScrollPane14.setName("jScrollPane14"); // NOI18N

        jta_archivo.setName("jta_archivo"); // NOI18N
        jScrollPane14.setViewportView(jta_archivo);

        jLabel89.setText(resourceMap.getString("jLabel89.text")); // NOI18N
        jLabel89.setName("jLabel89"); // NOI18N

        jbtn_importarfile.setIcon(resourceMap.getIcon("jbtn_importarfile.icon")); // NOI18N
        jbtn_importarfile.setText(resourceMap.getString("jbtn_importarfile.text")); // NOI18N
        jbtn_importarfile.setName("jbtn_importarfile"); // NOI18N
        jbtn_importarfile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_importarfileActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel89)
                    .addComponent(jbtn_importarfile)
                    .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 865, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(21, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel89)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtn_importarfile)
                .addContainerGap(53, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(100, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(334, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N
        jMenu2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu2ActionPerformed(evt);
            }
        });

        jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
        jmni_escape.setName("jmni_escape"); // NOI18N
        jmni_escape.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_escapeActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_escape);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jmni_nuevafactura.setText(resourceMap.getString("jmni_nuevafactura.text")); // NOI18N
        jmni_nuevafactura.setName("jmni_nuevafactura"); // NOI18N
        jmni_nuevafactura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_nuevafacturaActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_nuevafactura);

        jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N
        jMenuItem2.setName("jMenuItem2"); // NOI18N
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jmni_imprimir_gpo.setText(resourceMap.getString("jmni_imprimir_gpo.text")); // NOI18N
        jmni_imprimir_gpo.setName("jmni_imprimir_gpo"); // NOI18N
        jmni_imprimir_gpo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_imprimir_gpoActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_imprimir_gpo);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 991, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 601, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0)
        {

                        this.dispose();

        }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jtf_clienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_clienteActionPerformed
        // TODO add your handling code here:
        this.jtf_domcalle1.requestFocus();
}//GEN-LAST:event_jtf_clienteActionPerformed

    private void jtf_observaciones1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_observaciones1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtf_observaciones1ActionPerformed

    private void jtf_dompobla1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_dompobla1ActionPerformed
        // TODO add your handling code here:
        this.jtf_email2.requestFocus();
}//GEN-LAST:event_jtf_dompobla1ActionPerformed

    private void jtf_cpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_cpActionPerformed
        // TODO add your handling code here:
        this.jtf_rfc1.requestFocus();
}//GEN-LAST:event_jtf_cpActionPerformed

    private void jtf_domcalle1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_domcalle1ActionPerformed
        // TODO add your handling code here:
        this.jtf_domcolonia1.requestFocus();
}//GEN-LAST:event_jtf_domcalle1ActionPerformed

    private void jtf_domcolonia1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_domcolonia1ActionPerformed
        // TODO add your handling code here:
        this.jtf_dompobla1.requestFocus();
}//GEN-LAST:event_jtf_domcolonia1ActionPerformed

    private void jtf_email2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_email2ActionPerformed
        // TODO add your handling code here:
        this.jtf_cp.requestFocus();
}//GEN-LAST:event_jtf_email2ActionPerformed

    private void jtf_direccion3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_direccion3ActionPerformed
        // TODO add your handling code here:
        this.jtf_atnventas.requestFocus();
}//GEN-LAST:event_jtf_direccion3ActionPerformed

    private void jtf_rfc1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_rfc1ActionPerformed
        // TODO add your handling code here:
        this.jtf_tel.requestFocus();
}//GEN-LAST:event_jtf_rfc1ActionPerformed

    private void jtf_telActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_telActionPerformed
        // TODO add your handling code here:
        this.jtf_direccion3.requestFocus();
}//GEN-LAST:event_jtf_telActionPerformed

    private void jtf_atnventasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_atnventasActionPerformed
        // TODO add your handling code here:
        this.jtf_atncobra.requestFocus();
}//GEN-LAST:event_jtf_atnventasActionPerformed

    private void jtf_atncobraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_atncobraActionPerformed
        // TODO add your handling code here:
        this.jtf_observaciones1.requestFocus();
}//GEN-LAST:event_jtf_atncobraActionPerformed

    private void jtf_fpimpuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_fpimpuActionPerformed
        // TODO add your handling code here:
        this.calcularimportesfactura();
}//GEN-LAST:event_jtf_fpimpuActionPerformed

    private void jtf_fotosartxpagActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_fotosartxpagActionPerformed
        // TODO add your handling code here:
        this.carga_datos_facturapaginacion(Integer.valueOf(this.jtf_paginaactual.getText().toString()));
}//GEN-LAST:event_jtf_fotosartxpagActionPerformed

    private void jbtn_anteriorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_anteriorActionPerformed
        // TODO add your handling code here:
        this.jtf_paginaactual.setText(String.valueOf(Integer.valueOf(this.jtf_paginaactual.getText().toString())-1));
        System.out.println("Esta es la pagina que mando"+this.jtf_paginaactual.getText());
        this.carga_datos_facturapaginacion(Integer.valueOf(this.jtf_paginaactual.getText().toString())-1);
}//GEN-LAST:event_jbtn_anteriorActionPerformed

    private void jtf_paginaactualActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_paginaactualActionPerformed
        // TODO add your handling code here:
        this.carga_datos_facturapaginacion(Integer.valueOf(this.jtf_paginaactual.getText().toString())-1);
}//GEN-LAST:event_jtf_paginaactualActionPerformed

    private void jbtn_siguienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_siguienteActionPerformed
        // TODO add your handling code here:
        this.jtf_paginaactual.setText(String.valueOf(Integer.valueOf(this.jtf_paginaactual.getText().toString())+1));
        System.out.println("Esta es la pagina que mando"+this.jtf_paginaactual.getText());
        this.carga_datos_facturapaginacion(Integer.valueOf(this.jtf_paginaactual.getText().toString())-1);
    }//GEN-LAST:event_jbtn_siguienteActionPerformed

    private void jbtn_imprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_imprimirActionPerformed
        // TODO add your handling code here:
        String codinifin="",texto="",jtfoliofa="",retorno="",factura[]=null;
        factura=this.jcbx_facturara.getSelectedItem().toString().split(":");
        if(this.jtf_rfc1.getText().toString().length()>1)
            {
                    if(JOptionPane.showConfirmDialog(null, "<html><h2>Estan Correctos tus Datos?<br><Factura es de:<br>"+factura[1]+"<br>Condicion de Pago:"+this.jtf_metodopago.getText().toUpperCase()+"<br> "+this.jtf_observaciones1.getText()+"<br>Fecha:"+this.jtf_ffecha.getText()+"<br>% Impuesto:"+this.jtf_fpimpu.getText()+"%</h2></html>")==0)
                        {
                            codinifin=this.jtable_modelo_facturabloque.getValueAt(0,2).toString()+":"+this.jtable_modelo_facturabloque.getValueAt(this.jtable_modelo_facturabloque.getRowCount()-1, 2).toString();
                            jtfoliofa=JOptionPane.showInputDialog("Ingresa Folio factura:");
                            if(jtfoliofa.length()>0)
                                {
                                texto="select * from x1distribucion_terminados_ventas_fac_insert(1,'"+buscamp+"','"+this.jtf_folioactual.getText().toString()+"',"+variables_global.getId_empleado()+",'"+jtfoliofa+"','"+this.jtf_idcliente1.getText()+"','"+this.jtf_fsubtotal.getText().replace(",", "")+"','"+this.jtf_fImpuesto.getText().replace(",", "")+"','"+this.jtf_ftotal.getText().replace(",", "")+"','"+this.jtf_paginaactual.getText()+"','"+codinifin+"','1','','"+this.jtf_rfc1.getText()+"_"+this.jtf_ffecha.getText().replace("/", "-")+"');";
                                System.out.println(texto);
                                try
                                    {
                                        rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                                        while (rs.next())
                                            {
                                                retorno=rs.getString(1);
                                            }
                                    }
                                    catch(Exception e)
                                    {
                                            System.out.println(e.getMessage());
                                    }
                            if (this.jcbx_nuevaformato.isSelected()==true)
                                {
                                        this.imprimirfacturan(0,0);
                                }
                            else
                                {
                                    if(this.jcbx_facturara.getSelectedIndex()>0)
                                        {
                                            this.imprimirfactura(0,0);
                                        }
                                    else
                                    {
                                        JOptionPane.showMessageDialog(null,"Eliga de Quien es la Factura","Sistema Integral(Facturas) : Ayuda",1);
                                    }
                                }
                            }
                            else
                            {
                                JOptionPane.showMessageDialog(null,"Ingrese Folio para Imprimir", "Sistema Integral Facturas",1);
                            }
                    }
            }
        else
        {
            JOptionPane.showMessageDialog(null,"Por favor Elije una Razon a Facturar! o Eliga de Quien es la Factura","Sistema Integral(Facturas) : Ayuda",1);
        }
        
}//GEN-LAST:event_jbtn_imprimirActionPerformed

    private void jtf_fmargenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_fmargenActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jtf_fmargenActionPerformed

    private void jrbtn_recepcionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_recepcionActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_recepcionActionPerformed

    private void jrbtn_creditoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_creditoActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_creditoActionPerformed

    private void jrbtn_traspasoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_traspasoActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_traspasoActionPerformed

    private void jrbtn_movextraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_movextraActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_movextraActionPerformed

    private void jtf_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_busquedaActionPerformed
        // TODO add your handling code here:
        this.jbtn_busquedaActionPerformed(evt);
}//GEN-LAST:event_jtf_busquedaActionPerformed

    private void jbtn_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_busquedaActionPerformed
        // TODO add your handling code here:
        String idtienda[]=this.jcbx_tiendas.getSelectedItem().toString().split(":");
        if(JOptionPane.showConfirmDialog(null, "Estan correcto sus Datos?")==0)
            {

                 if (this.jcbx_acumfolios.isSelected()==false)
                        {
                            this.jtf_folioactual.setText(this.jtf_busqueda.getText().toUpperCase());
                        }
                 else
                        {
                            this.jtf_folioactual.setText(this.jtf_folioactual.getText()+":"+this.jtf_busqueda.getText().toUpperCase());
                        }


                switch (buscamp)
                    {
                    case 1:
                              this.carga_datos_detalle(this.jtf_busqueda.getText().toUpperCase());
                    break;
                    case 2:
                            if(!idtienda[0].equals("0"))
                                {
                                    this.carga_datos_detallecredito(1, idtienda[0],this.jtf_busqueda.getText().toUpperCase());
                                }
                            else
                                {
                                    JOptionPane.showMessageDialog(null,"Elija una Tienda", "Sistema Integral(Realizar Facturas) : Ayuda",1);
                                }

                    break;
                    case 3:
                                this.carga_datos_detalle_tras(3,this.jtf_busqueda.getText().toUpperCase());
                    break;
                    case 4:
                        if(!idtienda[0].equals("0"))
                                {
                                    this.carga_datos_detalle_movextra(1, idtienda[0],this.jtf_busqueda.getText().toUpperCase());
                                 }
                            else
                                {
                                    JOptionPane.showMessageDialog(null,"Elija una Tienda", "Sistema Integral(Realizar Facturas) : Ayuda",1);
                                }
                    break;
                    case 5:
                        if(!idtienda[0].equals("0"))
                                {
                                    this.carga_datos_detallepedido(3, idtienda[0],this.jtf_busqueda.getText().toUpperCase());
                                }
                            else
                                {
                                    JOptionPane.showMessageDialog(null,"Elija una Tienda", "Sistema Integral(Realizar Facturas) : Ayuda",1);
                                }
                    break;
                }
                this.jtf_paginaactual.setText("1");
                this.centrar_datos();
                this.calcularimportesfactura_gral();
                this.jtf_paginaactual.setText("1");
                this.carga_datos_facturapaginacion(0);
                this.paginas();
        }
    }//GEN-LAST:event_jbtn_busquedaActionPerformed

    private void jcbx_tiendasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_tiendasActionPerformed
        // TODO add your handling code here:

       

        //this.jtfpruebados.setText(jtable_tiendas.getValueAt(indeceta, 0).toString());
}//GEN-LAST:event_jcbx_tiendasActionPerformed

    private void dioclickfactura(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        String cliente[]=this.jlst_clientesdistribucion.getSelectedValue().toString().split(":");

           this.carga_datos_clientesactualiza(2,cliente[0]);
    }

    private void jrbtn_pedidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_pedidoActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_pedidoActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        this.jbtn_imprimirActionPerformed(evt);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jrbtn_importecostoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_importecostoActionPerformed
        // TODO add your handling code here:
       opcionimporte=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_importecostoActionPerformed

    private void jrbtn_importeprecioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_importeprecioActionPerformed
        // TODO add your handling code here:
        opcionimporte=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_importeprecioActionPerformed

    private void jcbx_acumfoliosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_acumfoliosActionPerformed
        // TODO add your handling code here:

        // if(JOptionPane.showConfirmDialog(null, "Estan Correctos sus Datos?")==0)
        //   {
        //         tiporeportecreado=3;//
        //         System.out.println("se marco lo historico:"+tiporeportecreado);
        //        this.generohistorico();
        //}


}//GEN-LAST:event_jcbx_acumfoliosActionPerformed

    private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed
        // TODO add your handling code here:


    }//GEN-LAST:event_jMenu2ActionPerformed

    private void jmni_nuevafacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_nuevafacturaActionPerformed
        // TODO add your handling code here:
           if(JOptionPane.showConfirmDialog(null, "Desea Limpiar Datos?")==0)
                {
                    while(jtable_modelo_facturacompleta.getRowCount()>0)jtable_modelo_facturacompleta.removeRow(0);
                }
    }//GEN-LAST:event_jmni_nuevafacturaActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        int fila = jt_formatofactura2.getSelectedRow();
        String altura[]=null,totalmatusado[]=null,piezastot="";
        DecimalFormat miformat = new DecimalFormat("###,###,###,###.####");
        DecimalFormat miformatusado = new DecimalFormat("###,###,###,###");

        if(JOptionPane.showConfirmDialog(null, "Desea Eliminar Fila Seleccionada?")==0)
            {
                jtable_modelo_facturacompleta.removeRow(fila);
                this.jtf_paginaactual.setText("0");
                this.calcularimportesfactura_gral();
                this.carga_datos_facturapaginacion(0);
                this.paginas();
            }
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jTabbedPane1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane1StateChanged
        // TODO add your handling code here:
        int index=this.jTabbedPane1.getSelectedIndex();
        if (index==1)
            {
                this.carga_datos_facturas(1, "", "");
            }
    }//GEN-LAST:event_jTabbedPane1StateChanged

    private void jt_formatofactura2PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jt_formatofactura2PropertyChange
        // TODO add your handling code here:
        this.calcularimportesfactura_gral();
        this.carga_datos_facturapaginacion(Integer.valueOf(this.jtf_paginaactual.getText().toString())-1);
    }//GEN-LAST:event_jt_formatofactura2PropertyChange

    private void jcbx_facturaraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_facturaraActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jcbx_facturaraActionPerformed

    private void jtf_metodopagoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_metodopagoActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jtf_metodopagoActionPerformed

    private void jrbtn_acucodigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_acucodigoActionPerformed
        // TODO add your handling code here:

      opcionacumular=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrbtn_acucodigoActionPerformed

    private void jrbtn_acuitemprActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_acuitemprActionPerformed
        // TODO add your handling code here:
        opcionacumular=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrbtn_acuitemprActionPerformed

    private void jrbtn_acucodigo1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_acucodigo1ActionPerformed
        // TODO add your handling code here:
        opcionacumular=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrbtn_acucodigo1ActionPerformed

    private void jrbtn_acucodigo2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_acucodigo2ActionPerformed
        // TODO add your handling code here:
        opcionacumular=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrbtn_acucodigo2ActionPerformed

    private void jmni_imprimir_gpoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_imprimir_gpoActionPerformed
        // TODO add your handling code here:
                String codinifin="",texto="",jtfoliofa="",retorno="",factura[]=null;
        factura=this.jcbx_facturara.getSelectedItem().toString().split(":");
        if(this.jtf_rfc1.getText().toString().length()>1)
            {
                    if(JOptionPane.showConfirmDialog(null, "<html><h2>Estan Correctos tus Datos?<br><Factura es de:<br>"+factura[1]+"<br>Condicion de Pago:"+this.jtf_metodopago.getText().toUpperCase()+"<br> "+this.jtf_observaciones1.getText()+"<br>Fecha:"+this.jtf_ffecha.getText()+"<br>% Impuesto:"+this.jtf_fpimpu.getText()+"%</h2></html>")==0)
                        {
                            codinifin=this.jtable_modelo_facturabloque.getValueAt(0,2).toString()+":"+this.jtable_modelo_facturabloque.getValueAt(this.jtable_modelo_facturabloque.getRowCount()-1, 2).toString();
                            jtfoliofa=JOptionPane.showInputDialog("Ingresa Folio factura:");
                            if(jtfoliofa.length()>0)
                                {
                                texto="select * from x1distribucion_terminados_ventas_fac_insert(1,'"+buscamp+"','"+this.jtf_folioactual.getText().toString()+"',"+variables_global.getId_empleado()+",'"+jtfoliofa+"','"+this.jtf_idcliente1.getText()+"','"+this.jtf_fsubtotal.getText().replace(",", "")+"','"+this.jtf_fImpuesto.getText().replace(",", "")+"','"+this.jtf_ftotal.getText().replace(",", "")+"','"+this.jtf_paginaactual.getText()+"','"+codinifin+"','1','','"+this.jtf_rfc1.getText()+"_"+this.jtf_ffecha.getText().replace("/", "-")+"');";
                                System.out.println(texto);
                                try
                                    {
                                        rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                                        while (rs.next())
                                            {
                                                retorno=rs.getString(1);
                                            }
                                    }
                                    catch(Exception e)
                                    {
                                            System.out.println(e.getMessage());
                                    }

                                        this.imprimirfactura2(0,0);

                            }
                            else
                            {
                                JOptionPane.showMessageDialog(null,"Ingrese Folio para Imprimir", "Sistema Integral Facturas",1);
                            }
                    }
            }
        else
        {
            JOptionPane.showMessageDialog(null,"Por favor Elije una Razon a Facturar! o Eliga de Quien es la Factura","Sistema Integral(Facturas) : Ayuda",1);
        }

}//GEN-LAST:event_jmni_imprimir_gpoActionPerformed

    private void jtf_idcliente1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_idcliente1ActionPerformed
        // TODO add your handling code here:
        this.carga_datos_clientesactualiza(2,this.jtf_idcliente1.getText());
    }//GEN-LAST:event_jtf_idcliente1ActionPerformed

    private void jbtn_importarfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_importarfileActionPerformed
        // TODO add your handling code here:
        String arreglo_importa[]=this.jta_archivo.getText().split("\n");
        String arreglo_codigo[]=null;
        System.out.println("Estos tiene archivo:"+arreglo_importa.length);
        if(JOptionPane.showConfirmDialog(null, "Desea Importar los Datos?")==0) {
            for (int i=0;i<arreglo_importa.length;i++)
                {
                    arreglo_codigo=arreglo_importa[i].split("\t");
//                    this.crea_hoja_factura(busca,rs.getString ("piezas"),rs.getString ("descor"),rs.getString ("claveproducto"),miformat.format(rs.getFloat("ultimocosto")),miformat.format(rs.getFloat("ultimocosto")*rs.getFloat("piezas")),rs.getString ("descor").replace(".", "")+".",rs.getString ("item").replace(".", "")+".",co);
                    this.crea_hoja_factura(arreglo_codigo[0],arreglo_codigo[1],arreglo_codigo[2],arreglo_codigo[3],arreglo_codigo[5],arreglo_codigo[6],arreglo_codigo[2],arreglo_codigo[4],arreglo_codigo[4]);
                }
            this.jta_archivo.setText("");
        } else {
            //this.jtf_hojacantidadinsumo.requestFocus();
        }
    }//GEN-LAST:event_jbtn_importarfileActionPerformed

    private void jtf_fotosartxpag1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_fotosartxpag1ActionPerformed
        // TODO add your handling code here:
        this.calcularimportesquitarpor();
        this.calcularimportesfactura_gral();
    }//GEN-LAST:event_jtf_fotosartxpag1ActionPerformed
 private void jtbl_facturasgMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ventas_sie_impresionfacturas().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel46;
    private javax.swing.JLabel jLabel47;
    private javax.swing.JLabel jLabel48;
    private javax.swing.JLabel jLabel49;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel50;
    private javax.swing.JLabel jLabel51;
    private javax.swing.JLabel jLabel52;
    private javax.swing.JLabel jLabel53;
    private javax.swing.JLabel jLabel54;
    private javax.swing.JLabel jLabel55;
    private javax.swing.JLabel jLabel56;
    private javax.swing.JLabel jLabel57;
    private javax.swing.JLabel jLabel58;
    private javax.swing.JLabel jLabel59;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel60;
    private javax.swing.JLabel jLabel61;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel89;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane12;
    private javax.swing.JScrollPane jScrollPane13;
    private javax.swing.JScrollPane jScrollPane14;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jbtn_anterior;
    private javax.swing.JButton jbtn_busqueda;
    private javax.swing.JButton jbtn_importarfile;
    private javax.swing.JButton jbtn_imprimir;
    private javax.swing.JButton jbtn_siguiente;
    private javax.swing.JCheckBox jcbx_acumfolios;
    private javax.swing.JComboBox jcbx_facturara;
    private javax.swing.JCheckBox jcbx_nuevaformato;
    private javax.swing.JComboBox jcbx_tiendas;
    private javax.swing.JEditorPane jep_historiprint;
    private javax.swing.JLabel jlbl_paginas;
    private javax.swing.JLabel jlbl_paginas1;
    private javax.swing.JLabel jlbl_paginas2;
    private javax.swing.JList jlst_clientesdistribucion;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_imprimir_gpo;
    private javax.swing.JMenuItem jmni_nuevafactura;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JRadioButton jrbtn_acucodigo;
    private javax.swing.JRadioButton jrbtn_acucodigo1;
    private javax.swing.JRadioButton jrbtn_acucodigo2;
    private javax.swing.JRadioButton jrbtn_acuitempr;
    private javax.swing.JRadioButton jrbtn_credito;
    private javax.swing.JRadioButton jrbtn_importecosto;
    private javax.swing.JRadioButton jrbtn_importeprecio;
    private javax.swing.JRadioButton jrbtn_movextra;
    private javax.swing.JRadioButton jrbtn_pedido;
    private javax.swing.JRadioButton jrbtn_recepcion;
    private javax.swing.JRadioButton jrbtn_traspaso;
    private javax.swing.JTable jt_formatofactura1;
    private javax.swing.JTable jt_formatofactura2;
    private javax.swing.JEditorPane jta_archivo;
    private javax.swing.JTable jtbl_facturasg;
    private javax.swing.JTextField jtf_atncobra;
    private javax.swing.JTextField jtf_atnventas;
    private javax.swing.JTextField jtf_busqueda;
    private javax.swing.JTextField jtf_cliente;
    private javax.swing.JTextField jtf_cp;
    private javax.swing.JTextField jtf_direccion3;
    private javax.swing.JTextField jtf_domcalle1;
    private javax.swing.JTextField jtf_domcolonia1;
    private javax.swing.JTextField jtf_dompobla1;
    private javax.swing.JTextField jtf_email2;
    private javax.swing.JTextField jtf_fImpuesto;
    private javax.swing.JTextField jtf_fImpuestogral;
    private javax.swing.JTextField jtf_fdesc;
    private javax.swing.JTextField jtf_fdescuento;
    private javax.swing.JTextField jtf_fdescuentogral;
    private javax.swing.JTextField jtf_ffecha;
    private javax.swing.JTextField jtf_fmargen;
    private javax.swing.JTextField jtf_folioactual;
    private javax.swing.JTextField jtf_fotosartxpag;
    private javax.swing.JTextField jtf_fotosartxpag1;
    private javax.swing.JTextField jtf_fpimpu;
    private javax.swing.JTextField jtf_fsubtotal;
    private javax.swing.JTextField jtf_fsubtotalgral;
    private javax.swing.JTextField jtf_ftotal;
    private javax.swing.JTextField jtf_ftotalgral;
    private javax.swing.JTextField jtf_idcliente1;
    private javax.swing.JTextField jtf_importepesos;
    private javax.swing.JTextField jtf_metodopago;
    private javax.swing.JTextField jtf_observaciones1;
    private javax.swing.JTextField jtf_paginaactual;
    private javax.swing.JTextField jtf_rfc1;
    private javax.swing.JTextField jtf_tel;
    // End of variables declaration//GEN-END:variables
  private sie_impresiones objimpresora;
}
